norm_tests {neatStats} | R Documentation |
Normality Tests and Plots
Description
Performs normality tests and creates related plots (histogram,
density, Q-Q). This is primarily a subfunction of t_neat
and
anova_neat
, but here it is available separately for other
potential purposes.
Usage
norm_tests(
var1,
var2 = NULL,
pair = FALSE,
norm_tests = "all",
alpha = 0.05,
plots = FALSE,
aspect_ratio = 1,
hush = FALSE
)
Arguments
var1 |
Numeric vector; numbers of any given variable. |
var2 |
Optional numeric vector (or |
pair |
Logical; only matters if |
norm_tests |
Normality tests. Any or all of the following character input
is accepted (as a single string or a character vector; case-insensitive):
|
alpha |
Numeric ( |
plots |
Logical: if |
aspect_ratio |
Aspect ratio of the plots: |
hush |
Logical. If |
Value
Prints normality tests, and displays plots if so specified. Returns
TRUE
if any of the specified tests has p value below the specified
alpha
, otherwise returns FALSE
.
Note
Normality tests are all calculated via
fBasics::NormalityTests
, selected based
on the recommendation of Lakens (2015), quoting Yap and Sim (2011, p. 2153):
"If the distribution is symmetric with low kurtosis values (i.e. symmetric
short-tailed distribution), then the D'Agostino and Shapiro-Wilkes tests have
good power. For symmetric distribution with high sample kurtosis (symmetric
long-tailed), the researcher can use the JB, Shapiro-Wilkes, or
Anderson-Darling test." See urlhttps://github.com/Lakens/perfect-t-test for
more details.
References
Lakens, D. (2015). The perfect t-test (version 1.0.0). Retrieved from https://github.com/Lakens/perfect-t-test. doi:10.5281/zenodo.17603
Yap, B. W., & Sim, C. H. (2011). Comparisons of various types of normality tests. Journal of Statistical Computation and Simulation, 81(12), 2141–2155. doi:10.1080/00949655.2010.520163
See Also
Examples
norm_tests(stats::rnorm(100))
# should be normal...