Skewness
skewness.RdComputes the skewness.
Details
If x contains missings and these are not removed, the skewness
is NA.
Otherwise, write \(x_i\) for the non-missing elements of x,
\(n\) for their number, \(\mu\) for their mean, \(s\) for
their standard deviation, and
\(m_r = \sum_i (x_i - \mu)^r / n\)
for the sample moments of order \(r\).
Joanes and Gill (1998) discuss three methods for estimating skewness:
- Type 1:
\(g_1 = m_3 / m_2^{3/2}\). This is the typical definition used in many older textbooks.
- Type 2:
\(G_1 = g_1 \sqrt{n(n-1)} / (n-2)\). Used in SAS and SPSS.
- Type 3:
\(b_1 = m_3 / s^3 = g_1 ((n-1)/n)^{3/2}\). Used in MINITAB and BMDP.
All three skewness measures are unbiased under normality.
References
D. N. Joanes and C. A. Gill (1998), Comparing measures of sample skewness and kurtosis. The Statistician, 47, 183–189.
Examples
x <- rnorm(100)
skewness(x)
#> [1] -0.3417001