Learn R Programming

propagate (version 1.0-6)

moments: Skewness and (excess) Kurtosis of a vector of values

Description

These functions calculate skewness and excess kurtosis of a vector of values. They were taken from the package 'moments'.

Usage

skewness(x, na.rm = FALSE) 
kurtosis(x, na.rm = FALSE)

Arguments

x

a numeric vector, matrix or data frame.

na.rm

logical. Should missing values be removed?

Value

The skewness/kurtosis values.

Details

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$$

Examples

Run this code
# NOT RUN {
X <- rnorm(100, 20, 2)
skewness(X)
kurtosis(X)
# }

Run the code above in your browser using DataLab