Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

check_normaldist

Compare distribution of data with normal distribution.


Description

Compare distribution of data with normal distribution.

Usage

check_normaldist(
  res,
  col = "red",
  col.normal = "black",
  legend.pos = "topright",
  legend.label = "data",
  ...
)

Arguments

res

Vector with residuals or other data for which the distribution .

col

Color for filling the area. Default is black.

col.normal

Color for shading and line of normal distribution.

legend.pos

Position of legend, can be string (e.g., 'topleft') or an xy.coords object.

legend.label

Text string, label for plotted data distribution.

...

Optional arguments for the lines. See par.

Note

Assumes centered data as input.

Author(s)

Jacolien van Rij

See Also

Examples

set.seed(123)
# normal distribution:
test <- rnorm(1000)
check_normaldist(test)
# t-distribution:
test <- rt(1000, df=5)
check_normaldist(test)
# skewed data, e.g., reaction times:
test <- exp(rnorm(1000, mean=.500, sd=.25))
check_normaldist(test)
# center first:
check_normaldist(scale(test))
# binomial distribution:
test <- rbinom(1000, 1, .3)
check_normaldist(test)
# count data:
test <- rbinom(1000, 100, .3)
check_normaldist(test)

plotfunctions

Various Functions to Facilitate Visualization of Data and Analysis

v1.4
GPL (>= 2)
Authors
Jacolien van Rij [aut, cre]
Initial release
2020-04-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.