If na.rm
is TRUE
then missing values are removed before computation proceeds.
The methods for calculating the skewness can either be:
method = 1: g_1 = m_3 / m_2^(3/2)
method = 2: G_1 = g_1 * sqrt(n(n-1)) / (n-2)
method = 3: b_1 = m_3 / s^3 = g_1 ((n-1)/n)^(3/2)
and the ones for the kurtosis:
method = 1: g_2 = m_4 / m_2^2 - 3
method = 2: G_2 = ((n+1) g_2 + 6) * (n-1) / ((n-2)(n-3))
method = 3: b_2 = m_4 / s^4 - 3 = (g_2 + 3) (1 - 1/n)^2 - 3
method = 1 is the typical definition used in many older textbooks.
method = 2 is used in SAS and SPSS.
method = 3 is used in MINITAB and BMDP.
Cramer et al. (1997) mention the asymptotic standard error of the skewness, resp. kurtosis:
ASE.skew = sqrt( 6n(n-1)/((n-2)(n+1)(n+3)) )
ASE.kurt = sqrt( (n^2 - 1)/((n-3)(n+5)) )
to be used for calculating the confidence intervals. This is implemented here with ci.type="classic"
. However, Joanes and Gill (1998) advise against this approach, pointing out that the normal assumptions would virtually always be violated.
They suggest using the bootstrap method. That's why the default method for the confidence interval type is set to "bca"
.
This implementation of the two functions is comparably fast, as the expensive sums are coded in C.