normal_test {tidysummary} | R Documentation |
Perform normality test on a variable
Description
Conducts normality tests for a specified variable, optionally by group. Supports automatic testing and interactive visualization.
Usage
normal_test(data = NULL, var = NULL, group = NULL, norm = "auto")
Arguments
data |
A data frame containing the variables to be tested. |
var |
A character string specifying the numeric variable in |
group |
A character string specifying the grouping variable in |
norm |
Control parameter for test behavior. Accepts:
|
Value
A logical value:
-
TRUE
: data are normally distributed -
FALSE
: data are not normally distributed
Methodology for p-values
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
Examples
normal_test(iris, "Sepal.Length", "Species", norm = "auto")
normal_test(iris, "Sepal.Length", "Species", norm = TRUE)