Perform a test of normality for each group separately. The available tests: Shapiro-Wilk (default), Lilliefors (Kolmogorov-Smirnov), Anderson-Darling and other.
test_normality( y, data = NULL, test = "Shapiro-Wilk", p_adjust_method = NULL, ..., groups = NULL, ss = signif_syms, hide_error_msg = FALSE ) # S3 method for test_normality print( x, ..., digits_p = 3, signif_stars = !is.null(ss), digits_stat = 3, format_stat = c("auto", "f", "g"), rm_zero = FALSE, legend = TRUE, show_col_method = FALSE, hide_error_msg = attr(x, "hide_error_msg"), ss = attr(x, "ss") ) # S3 method for test_normality pander( x, caption = NA, ..., digits_p = 3, signif_stars = !is.null(ss), digits_stat = 3, format_stat = c("auto", "f", "g"), rm_zero = FALSE, legend = TRUE, show_col_method = FALSE, hide_error_msg = attr(x, "hide_error_msg"), ss = attr(x, "ss") )
y | (formula|numeric|character)
|
---|---|
data | (data frame| |
test | (string | function)
|
p_adjust_method | ( |
... | Further parameters to the function of normatity test. |
groups | ( |
ss |
|
hide_error_msg | (logical) |
x |
|
digits_p | (numeric) Number of significant digits to round a p value to. No less than 2.
|
signif_stars | (logical) |
digits_stat | (integer) |
format_stat | (character) |
rm_zero | (logical) Flag if leading zero before the point should be removed. |
legend | (logical) |
show_col_method | (logical) |
caption | (string| |
Function test_normality
returns a data frame with
normality test results for each group.
print
and pander
methods format and print the
results. By default, methods print.test_normality
and
pander.test_normality
do not print column called "method".
stats::shapiro.test()
in package stats;
nortest::lillie.test()
in package nortest;
nortest::pearson.test()
in package nortest;
nortest::ad.test()
in package nortest;
nortest::cvm.test()
in package nortest;
nortest::sf.test()
in package nortest.
#> #> The results of Shapiro-Wilk normality test #> #> statistic p.value #> 1 0.941 <0.001 *** #> #> *** - p < 0.001, ** - p < 0.01, * - p < 0.05, . - p < 0.1# For each subgroup test_normality(uptake ~ Treatment, data = CO2)#> #> The results of Shapiro-Wilk normality test #> #> Treatment statistic p.value #> 1 nonchilled 0.945 0.043 * #> 2 chilled 0.898 0.001 ** #> #> *** - p < 0.001, ** - p < 0.01, * - p < 0.05, . - p < 0.1# For each subgroup by several factor variables rez <- test_normality(uptake ~ Type + Treatment, data = CO2) rez#> #> The results of Shapiro-Wilk normality test #> #> Type Treatment statistic p.value #> 1 Quebec nonchilled 0.825 0.002 ** #> 2 Quebec chilled 0.853 0.005 ** #> 3 Mississippi nonchilled 0.855 0.005 ** #> 4 Mississippi chilled 0.948 0.315 #> #> *** - p < 0.001, ** - p < 0.01, * - p < 0.05, . - p < 0.1#> #> The results of Shapiro-Wilk normality test #> #> Type Treatment statistic p.value #> 1 Quebec nonchilled .825 .002 ** #> 2 Quebec chilled .853 .005 ** #> 3 Mississippi nonchilled .855 .005 ** #> 4 Mississippi chilled .948 .315 #> #> *** - p < 0.001, ** - p < 0.01, * - p < 0.05, . - p < 0.1#> #> The results of Shapiro-Wilk normality test #> #> Type Treatment statistic p.value #> 1 Quebec nonchilled 0.825 <0.01 ** #> 2 Quebec chilled 0.853 <0.01 ** #> 3 Mississippi nonchilled 0.855 <0.01 ** #> 4 Mississippi chilled 0.948 0.31 #> #> *** - p < 0.001, ** - p < 0.01, * - p < 0.05, . - p < 0.1# Choose another test of normality rez2 <- test_normality(uptake ~ Type + Treatment, data = CO2, test = "chi-sq") rez2#> #> The results of Pearson chi-square normality test #> #> Type Treatment statistic p.value #> 1 Quebec nonchilled 13.3 0.010 ** #> 2 Quebec chilled 13.3 0.010 ** #> 3 Mississippi nonchilled 10.0 0.040 * #> 4 Mississippi chilled 5.3 0.255 #> #> *** - p < 0.001, ** - p < 0.01, * - p < 0.05, . - p < 0.1#> #> ------------------------------------------------- #> Type Treatment statistic p.value #> ------------- ------------ ----------- ---------- #> Quebec nonchilled 0.825 0.002 ** #> #> Quebec chilled 0.853 0.005 ** #> #> Mississippi nonchilled 0.855 0.005 ** #> #> Mississippi chilled 0.948 0.315 #> ------------------------------------------------- #> #> Table: The results of Shapiro-Wilk normality test. #> #> *** - p < 0.001 #> ** - p < 0.01 #> * - p < 0.05 #> . - p < 0.1#> #> ------------------------------------------------- #> Type Treatment statistic p.value #> ------------- ------------ ----------- ---------- #> Quebec nonchilled 0.83 0.002 ** #> #> Quebec chilled 0.85 0.005 ** #> #> Mississippi nonchilled 0.86 0.005 ** #> #> Mississippi chilled 0.95 0.315 #> ------------------------------------------------- #> #> Table: The results of Shapiro-Wilk normality test. #> #> *** - p < 0.001 #> ** - p < 0.01 #> * - p < 0.05 #> . - p < 0.1#> #> ------------------------------------------------- #> Type Treatment statistic p.value #> ------------- ------------ ----------- ---------- #> Quebec nonchilled 0.825 <0.01 ** #> #> Quebec chilled 0.853 <0.01 ** #> #> Mississippi nonchilled 0.855 <0.01 ** #> #> Mississippi chilled 0.948 0.31 #> ------------------------------------------------- #> #> Table: The results of Shapiro-Wilk normality test. #> #> *** - p < 0.001 #> ** - p < 0.01 #> * - p < 0.05 #> . - p < 0.1#> #> ------------------------------------------------ #> Type Treatment statistic p.value #> ------------- ------------ ----------- --------- #> Quebec nonchilled 0.825 0.0016 #> #> Quebec chilled 0.853 0.0048 #> #> Mississippi nonchilled 0.855 0.0052 #> #> Mississippi chilled 0.948 0.3147 #> ------------------------------------------------ #> #> Table: The results of Shapiro-Wilk normality test. #>if (FALSE) { # View unformatted results in a separate window View(rez) } # Show object's class class(rez)#> [1] "test_normality" "data.frame"