sktest | R Documentation |
This is an implementation of the sktest
function that is available in
Stata. The function returns a test for normality based on skewness and on
kurtosis, and the a combination of the two tests into an overall test
statistic.
All of this work here owes a big debt of gratitude and recognition to Stata and to the autovar package. (link here: https://github.com/roqua/autovar)
Skewness is a measure of the asymmetry of the probability distribution of a random variable about its mean. It represents the amount and direction of skew. On the other hand, Kurtosis represents the height and sharpness of the central peak relative to that of a standard bell curve.
Null hypothesis: the data follows a normal distribution.
Alternative hypothesis: the data does not follow a normal distribution.
sktest(data, ..., na_rm = TRUE, adjust = TRUE)
data |
A data frame or tibble. |
... |
Unquoted variable names. |
na_rm |
A logical value indicating whether NA values should be stripped
before the computation proceeds. Default = |
adjust |
A logical valules indicating whether overall chi-square
statistic and p-value should be adjusted as proposed by Royston (1991).
Default = |
A tibble with with variable names, number of observations, probability of skewness, probability of kurtosis, chi-square test statistic and p-value for the overall test of normality.
https://www.stata.com/manuals/rsktest.pdf
D’Agostino, R. B., A. J. Belanger, and R. B. D’Agostino, Jr. 1990. A suggestion for using powerful and informative tests of normality. American Statistician 44: 316–321. https://doi.org/10.2307/2684359.
Royston, P. 1991a. sg3.1: Tests for departure from normality. Stata Technical Bulletin 2: 16–17. Reprinted in Stata Technical Bulletin Reprints, vol. 1, pp. 101–104. College Station, TX: Stata Press.
autovar package. https://github.com/roqua/autovar
sktest(data = auto, mpg, trunk)
# We can reject the hypothesis that mpg is normally distributed, but we cannot
# reject the hypothesis that trunk is normally distributed, at least at the 12%
# level. The kurtosis for trunk is 2.19, and the p-value of 0.0445 shown in the
# table above indicates that it is significantly different from the kurtosis of
# a normal distribution at the 5% significance level. However, on the basis of
# skewness alone, we cannot reject the hypothesis that trunk is normally
# distributed.
sktest(data = auto, mpg, trunk, adjust = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.