| Title: | Tests for Departure from Normality |
|---|---|
| Description: | A toolkit for assessing data normality using a comprehensive collection of statistical methods. It includes descriptive measures and formal hypothesis tests, such as skewness and kurtosis tests, the Anderson–Darling test, the Shapiro–Wilk test, and the D'Agostino–Pearson K2 omnibus test. |
| Authors: | Joon-Keat Lai [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-9840-5836>) |
| Maintainer: | Joon-Keat Lai <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.1 |
| Built: | 2026-06-09 19:29:06 UTC |
| Source: | https://github.com/cran/normality |
Performs the Shapiro-Francia test of normality.
.Shapiro_Francia(x).Shapiro_Francia(x)
x |
Numeric vector. |
A list.
Shapiro, S.S., Francia, R.S., 1972. An Approximate Analysis of Variance Test for Normality. Journal of the American Statistical Association 67, 215–216. https://doi.org/10.1080/01621459.1972.10481232
Royston, P., 1993. A pocket‐calculator algorithm for the shapiro‐francia test for non‐normality: An application to medicine. Statistics in Medicine 12, 181–184. https://doi.org/10.1002/sim.4780120209
Anderson-Darling Normality Test
Anderson_Darling_test(x, alpha = 0.05, min_n = 8, verbose = FALSE)Anderson_Darling_test(x, alpha = 0.05, min_n = 8, verbose = FALSE)
x |
A numeric vector. |
alpha |
Numeric (default: 0.05). Significance threshold, range from 0 to 1. |
min_n |
Integer. The minimum observations required (default: 8). |
verbose |
Logical (default: FALSE). Show messages. |
A list:
is_normal: Is the input data normally distributed?
method: The name of the test.
alpha: Significance threshold (default: 0.05).
alternative: The alternative hypothesis (H1) to test.
summary_table: Statistic summary, if any. Mostly output as a data frame.
statistic: The value used to calculate p-value.
pvalue: The p value.
confidence_interval: The lower and upper bound of confidence interval (CI).
D’Agostino, RalphB., 2017. Goodness-of-Fit Techniques, page 123-128 & 372-373. 1st ed. Routledge. https://doi.org/10.1201/9780203753064
Anderson_Darling_test(leghorn_chick)Anderson_Darling_test(leghorn_chick)
A numeric vector, the cholesterol values from a sample of 62 subjects from the Framingham Heart Study (FHS). This dataset was obtained from D'Agostino paper.
cholesterolcholesterol
A numeric vector length of 62.
D’agostino, R.B., Belanger, A., D’agostino, R.B., 1990. A Suggestion for Using Powerful and Informative Tests of Normality. The American Statistician 44, 316–321. https://doi.org/10.1080/00031305.1990.10475751
The D'Agostino–Pearson Chi-square (K2) test is a statistical test for assessing whether a sample comes from a normal distribution. It combines information from skewness (asymmetry) and kurtosis (tail heaviness) into a single omnibus test statistic.
D.Agostino_Pearson_test( x, alpha = 0.05, alternative = c("two.sided", "less", "greater"), min_n = 20 )D.Agostino_Pearson_test( x, alpha = 0.05, alternative = c("two.sided", "less", "greater"), min_n = 20 )
x |
A numeric vector. |
alpha |
Significance threshold (default: 0.05). |
alternative |
Character (default: "two.sided). The alternative hypothesis (H1) to test. Available options are c("two.sided", "less", "greater"). Note that, this is only applied on skewness and kurtosis test. |
min_n |
Integer. The minimum observations required (default: 20). |
A list:
is_normal: Is the input data normally distributed?
method: The name of the test.
alpha: Significance threshold (default: 0.05).
alternative: The alternative hypothesis (H1) to test.
summary_table: Statistic summary, if any. Mostly output as a data frame.
statistic: The value used to calculate p-value.
pvalue: The p value.
confidence_interval: The lower and upper bound of confidence interval (CI).
D’agostino, R.B., Belanger, A., D’agostino, R.B., 1990. A Suggestion for Using Powerful and Informative Tests of Normality. The American Statistician 44, 316–321. https://doi.org/10.1080/00031305.1990.10475751
D.Agostino_Pearson_test(cholesterol)D.Agostino_Pearson_test(cholesterol)
Kurtosis test
kurtosis( x, alpha = 0.05, alternative = c("two.sided", "less", "greater"), method = c("G2", "b2", "g2") )kurtosis( x, alpha = 0.05, alternative = c("two.sided", "less", "greater"), method = c("G2", "b2", "g2") )
x |
Numeric vector. The input data. |
alpha |
Numeric (default: 0.05). Significance threshold (0 - 1). |
alternative |
Character (default: "two.sided). The alternative hypothesis (H1) to test. Available options are c("two.sided", "less", "greater"). |
method |
Character (default: "G2"). Different skewness formula. Available options are c("G2", "b2", "g2"). The "g2" is the original one. The "G2" and "b2" are the unbiased estimate version of "g2". |
A list: is_normal: Is the input data normally distributed? method: The name of the test. alpha: Significance threshold (default: 0.05). alternative: The alternative hypothesis (H1) to test. summary_table: Statistic summary, if any. statistic: The value used to calculate p-value. pvalue: p-value. confidence_interval: The lower and upper bound of CI.
Joanes, D.N., Gill, C.A., 1998. Comparing measures of sample skewness and kurtosis. J Royal Statistical Soc D 47, 183–189. https://doi.org/10.1111/1467-9884.00122
Wright, D.B., Herrington, J.A., 2011. Problematic standard errors and confidence intervals for skewness and kurtosis. Behav Res 43, 8–17. https://doi.org/10.3758/s13428-010-0044-x
x <- c(10:17, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 15, 15) kurtosis(x)x <- c(10:17, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 15, 15) kurtosis(x)
A numeric vector
leghorn_chickleghorn_chick
A numeric vector length of 20.
D’Agostino, RalphB., 2017. Goodness-of-Fit Techniques, page 98 (Table 4.1). 1st ed. Routledge. https://doi.org/10.1201/9780203753064
The standard output format for normality package.
normality_standard_output( method = "what test?", is_normal = NA, alpha = NA_real_, alternative = c("two.sided", "less", "greater"), summary_table = NULL, statistic = NA_real_, pvalue = NA_real_, confidence_interval = c(lower = NA_real_, upper = NA_real_) )normality_standard_output( method = "what test?", is_normal = NA, alpha = NA_real_, alternative = c("two.sided", "less", "greater"), summary_table = NULL, statistic = NA_real_, pvalue = NA_real_, confidence_interval = c(lower = NA_real_, upper = NA_real_) )
method |
Character. The name of the test. |
is_normal |
Logical. Is the input data normally distributed? |
alpha |
Numeric (default: 0.05). Significance threshold. |
alternative |
Character. The alternative hypothesis (H1) to test. Available options are c("two.sided", "less", "greater"). |
summary_table |
Statistic summary, if any. |
statistic |
Numeric. The value used to calculate p-value. |
pvalue |
Numeric. The p-value of the test. |
confidence_interval |
Numeric vector of length 2. The lower and upper bound of CI. |
A list contains 8 vectors.
Skewness test
skewness( x, alpha = 0.05, alternative = c("two.sided", "less", "greater"), method = c("G1", "b1", "g1") )skewness( x, alpha = 0.05, alternative = c("two.sided", "less", "greater"), method = c("G1", "b1", "g1") )
x |
Numeric vector. The input data. |
alpha |
Numeric (default: 0.05). Significance threshold (0 - 1). |
alternative |
Character (default: "two.sided). The alternative hypothesis (H1) to test. Available options are c("two.sided", "less", "greater"). |
method |
Character (default: "G1"). Different skewness formula. Available options are c("G1", "b1", "g1"). The "g1" is the original one. The "G1" and "b1" are the unbiased estimate version of "g1". |
A list: is_normal: Is the input data normally distributed? method: The name of the test. alpha: Significance threshold (default: 0.05). alternative: The alternative hypothesis (H1) to test. summary_table: Statistic summary, if any. statistic: The value used to calculate p-value. pvalue: p-value. confidence_interval: The lower and upper bound of CI.
Joanes, D.N., Gill, C.A., 1998. Comparing measures of sample skewness and kurtosis. J Royal Statistical Soc D 47, 183–189. https://doi.org/10.1111/1467-9884.00122
Wright, D.B., Herrington, J.A., 2011. Problematic standard errors and confidence intervals for skewness and kurtosis. Behav Res 43, 8–17. https://doi.org/10.3758/s13428-010-0044-x
skewness(cholesterol)skewness(cholesterol)