Skip to contents

Test the normality of a numeric variable.

Usage

stat_normality(x, alpha = 0.05, digits = 5, print = FALSE)

Arguments

x

A numeric vector

alpha

A numeric single value (default = 0.05), that is the significance level to compute the variable 'is_normal'

digits

A integer single value (default = NULL), that will be the number used to round the values

print

A boolean value, if TRUE the function will print the values in the viewer (default = FALSE)

Value

A tibble (7x4) with each test: statistic, p-value and the condicional check of normality, given the alpha.

Details

Apply the following normality tests:


- Anderson-Darling
- Cramer-Von Mises
- Kolmogorov-Smirnov
- Lilliefors
- Pearson chi-square
- Shapiro-Francia
- Shapiro-Wilk

Examples


x <- rnorm(100)

stat_normality(x)
#> # A tibble: 7 × 4
#>   test                                     statistic p_value is_normal
#>   <chr>                                        <dbl>   <dbl> <lgl>    
#> 1 Anderson-Darling                            0.239    0.775 TRUE     
#> 2 Asymptotic one-sample Kolmogorov-Smirnov    0.0482   0.975 TRUE     
#> 3 Cramer-von Mises                            0.0416   0.648 TRUE     
#> 4 Lilliefors (Kolmogorov-Smirnov)             0.0482   0.823 TRUE     
#> 5 Pearson chi-square                          9.46     0.489 TRUE     
#> 6 Shapiro-Francia                             0.993    0.838 TRUE     
#> 7 Shapiro-Wilk                                0.993    0.912 TRUE