powered by
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)
a numeric vector, matrix or data frame.
logical. Should missing values be removed?
The skewness/kurtosis values.
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$$
# NOT RUN { X <- rnorm(100, 20, 2) skewness(X) kurtosis(X) # }
Run the code above in your browser using DataLab