skew | R Documentation |
Functions for skewness and kurtosis.
skew(x,method="unbiased")
kurt(x,method="unbiased")
x |
A vector of quantitative data. |
method |
The type of method used for computation of skew and kurtosis. Two choices are possible for skewness: |
Aside from centrality and variability we can describe distributions with respect to their shape. Two important shape descriptors are skewness and kurtosis. Skewness describes the relative density in the tails of a distribution while kurtosis describes the peakedness of a distribution. When quantified for a population skewness and kurtosis are denoted as \gamma_1
and \gamma_2
respectively. For a symmetric distribution skewness will equal zero; i.e. \gamma_1
= 0. A distribution with more density in its right-hand tail will have \gamma_1
> 0, while one with more density in its left-hand tail will have \gamma_1
< 0. These distributions are often referred to as positively-skewed and negatively-skewed respectively. If a distribution is normally peaked (mesokurtic) then \gamma_2
= 3. As a result the number three is generally subtracted from kurtosis estimates so that a normal distribution will have \gamma_2
= 0 . Thus strongly peaked (leptokurtic) distributions will have \gamma_2
> 0, while flat-looking (platykurtic) distributions will have a kurtosis \gamma_2
< 0.
Several types of skewness and kurtosis estimation are possible.
For method of moments estimation let:
m_j = (1/n)\sum_i({X_i-\bar{X}})^j,
then the method of moments skewness is: m_3/m_{2}^{3/2}
, the method of moments kurtosis is: m_4/m_2^2
, and the excess method of moments kurtosis is m_4/m_2^2 -3
.
These estimators are biased low, particularly given small sample sizes. A more complex estimator is required to account for this bias. This is provided by method = "unbiased"
in skew
and kurt
.
Output will be the sample skewness or kurtosis.
Ken Aho
exp<-rexp(10000)
skew(exp)
kurt(exp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.