powered by
Conducts normality tests for a specified variable, optionally by group. Supports automatic testing and interactive visualization.
normal_test(data = NULL, var = NULL, group = NULL, norm = "auto")
A logical value:
TRUE: data are normally distributed
TRUE
FALSE: data are not normally distributed
FALSE
A data frame containing the variables to be tested.
A character string specifying the numeric variable in data to test.
data
A character string specifying the grouping variable in data. If NULL, treated as one group.
NULL
Control parameter for test behavior. Accepts:
'auto': Automatically decide based on p-values, but the same as 'ask' when n > 1000, default
'auto'
'ask'
'ask': Show p-values, plots QQ plots and prompts for decision
TRUE/'true': Always returns TRUE
'true'
FALSE/'false': Always returns FALSE
'false'
Automatically selects test based on sample size per group:
n < 3: Too small, assuming non-normal
(3, 50] Shapiro-Wilk test
(50, 1000]: D'Agostino Chi2 test, instead of Kolmogorov-Smirnov test
n > 1000: Show p-values, plots QQ plots and prompts for decision
normal_test(iris, "Sepal.Length", "Species", norm = "auto") normal_test(iris, "Sepal.Length", "Species", norm = TRUE)
Run the code above in your browser using DataLab