moments | R Documentation |
These functions calculate skewness and excess kurtosis of a vector of values. They were taken from the package 'moments'.
skewness(x, na.rm = FALSE)
kurtosis(x, na.rm = FALSE)
x |
a numeric vector, matrix or data frame. |
na.rm |
logical. Should missing values be removed? |
Skewness:
\frac{\frac{1}{n} \sum_{i=1}^n (x_i-\overline{x})^3}{\left(\frac{1}{n} \sum_{i=1}^n (x_i-\overline{x})^2\right)^{3/2}}
(excess) Kurtosis:
\frac{\frac{1}{n} \sum_{i=1}^n (x_i - \overline{x})^4}{\left(\frac{1}{n} \sum_{i=1}^n (x_i - \overline{x})^2\right)^2} - 3
The skewness/kurtosis values.
Andrej-Nikolai Spiess
X <- rnorm(100, 20, 2)
skewness(X)
kurtosis(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.