skewness: Skewness

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/skewness.R

Description

This function encodes different methods to calculate the skewness from a vector of observations.

Usage

1
skewness(x, na.rm = FALSE, method = c("moment", "fisher", "bickel"), M, ...)

Arguments

x

numeric. Vector of observations.

na.rm

logical. Should missing values be removed?

method

character. Specifies the method of computation. These are either "moment", "fisher" or "bickel". The "moment" method is based on the definition of skewness for distributions; this form should be used when resampling (bootstrap or jackknife). The "fisher" method corresponds to the usual "unbiased" definition of sample variance, although in the case of skewness exact unbiasedness is not possible.

M

numeric. (An estimate of) the mode of the observations x. Default value is shorth(x).

...

Additional arguments.

Value

skewness returns a numeric value. An attribute reports the method used.

Author(s)

Diethelm Wuertz and contributors for the original skewness function from package fBasics.

References

See Also

mlv for general mode estimation; shorth for the shorth estimate of the mode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Skewness = 0
x <- rnorm(1000)
skewness(x, method = "bickel", M = shorth(x))

## Skewness > 0 (left skewed case)
x <- rbeta(1000, 2, 5)
skewness(x, method = "bickel", M = betaMode(2, 5))

## Skewness < 0 (right skewed case)
x <- rbeta(1000, 7, 2)
skewness(x, method = "bickel", M = hsm(x, bw = 1/3))

modeest documentation built on Nov. 18, 2019, 5:07 p.m.