Learn R Programming

optimStrat (version 2.0)

skewness: Sample Skewness

Description

Calculate the sample skewness.

Usage

skewness(x, na.rm = FALSE)

Arguments

x

a numeric vector.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

A vector of length one giving the sample skewness of x.

Details

Compute the sample skewness of x as $$\frac{\frac{1}{N}\sum_{i=1}^{N}\left(x_{i}-\bar{x}\right)^{3}}{\left[\frac{1}{N-1}\sum_{i=1}^{N}\left(x_{i}-\bar{x}\right)^{2}\right]^{3/2}}$$

Examples

Run this code
# NOT RUN {
x<- rnorm(1000)
skewness(x)
# }

Run the code above in your browser using DataLab