skewness {EnvStats}R Documentation

Coefficient of Skewness

Description

Compute the sample coefficient of skewness.

Usage

  skewness(x, na.rm = FALSE, method = "fisher", l.moment.method = "unbiased", 
    plot.pos.cons = c(a = 0.35, b = 0))

Arguments

x

numeric vector of observations.

na.rm

logical scalar indicating whether to remove missing values from x. If
na.rm=FALSE (the default) and x contains missing values, then a missing value (NA) is returned. If na.rm=TRUE, missing values are removed from x prior to computing the coefficient of variation.

method

character string specifying what method to use to compute the sample coefficient of skewness. The possible values are "fisher" (ratio of unbiased moment estimators; the default), "moments" (ratio of product moment estimators), or "l.moments" (ratio of LL-moment estimators).

l.moment.method

character string specifying what method to use to compute the LL-moments when method="l.moments". The possible values are "ubiased" (method based on the UU-statistic; the default), or "plotting.position" (method based on the plotting position formula).

plot.pos.cons

numeric vector of length 2 specifying the constants used in the formula for the plotting positions when method="l.moments" and
l.moment.method="plotting.position". The default value is
plot.pos.cons=c(a=0.35, b=0). If this vector has a names attribute with the value c("a","b") or c("b","a"), then the elements will be matched by name in the formula for computing the plotting positions. Otherwise, the first element is mapped to the name "a" and the second element to the name "b".

Details

Let x\underline{x} denote a random sample of nn observations from some distribution with mean μ\mu and standard deviation σ\sigma.

Product Moment Coefficient of Skewness (method="moment" or method="fisher")
The coefficient of skewness of a distribution is the third standardized moment about the mean:

η3=β1=μ3σ3            (1)\eta_3 = \sqrt{\beta_1} = \frac{\mu_3}{\sigma^3} \;\;\;\;\;\; (1)

where

ηr=E[(Xμσ)r]=1σrE[(Xμ)r]=μrσr            (2)\eta_r = E[(\frac{X-\mu}{\sigma})^r] = \frac{1}{\sigma^r} E[(X-\mu)^r] = \frac{\mu_r}{\sigma^r} \;\;\;\;\;\; (2)

and

μr=E[(Xμ)r]            (3)\mu_r = E[(X-\mu)^r] \;\;\;\;\;\; (3)

denotes the rr'th moment about the mean (central moment). That is, the coefficient of skewness is the third central moment divided by the cube of the standard deviation. The coefficient of skewness is 0 for a symmetric distribution. Distributions with positive skew have heavy right-hand tails, and distributions with negative skew have heavy left-hand tails.

When method="moment", the coefficient of skewness is estimated using the method of moments estimator for the third central moment and and the method of moments estimator for the variance:

η^3=μ^3σ3=1ni=1n(xixˉ)3[1ni=1n(xixˉ)2]3/2          (5)\hat{\eta}_3 = \frac{\hat{\mu}_3}{\sigma^3} = \frac{\frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^3}{[\frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2]^{3/2}} \;\;\;\;\; (5)

where

σ^m2=sm2=1ni=1n(xixˉ)2            (6)\hat{\sigma}^2_m = s^2_m = \frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2 \;\;\;\;\;\; (6)

This form of estimation should be used when resampling (bootstrap or jackknife).

When method="fisher", the coefficient of skewness is estimated using the unbiased estimator for the third central moment (Serfling, 1980, p.73; Chen, 1995, p.769) and the unbiased estimator for the variance.

η^3=n(n1)(n2)i=1n(xixˉ)3s3            (7)\hat{\eta}_3 = \frac{\frac{n}{(n-1)(n-2)} \sum_{i=1}^n (x_i - \bar{x})^3}{s^3} \;\;\;\;\;\; (7)

where

σ^2=s2=1n1i=1n(xixˉ)2            (8)\hat{\sigma}^2 = s^2 = \frac{1}{n-1} \sum_{i=1}^n (x_i - \bar{x})^2 \;\;\;\;\;\; (8)

(Note that Serfling, 1980, p.73 contains a typographical error in the numerator for the unbiased estimator of the third central moment.)

L-Moment Coefficient of skewness (method="l.moments")
Hosking (1990) defines the LL-moment analog of the coefficient of skewness as:

τ3=λ3λ2            (9)\tau_3 = \frac{\lambda_3}{\lambda_2} \;\;\;\;\;\; (9)

that is, the third LL-moment divided by the second LL-moment. He shows that this quantity lies in the interval (-1, 1).

When l.moment.method="unbiased", the LL-skewness is estimated by:

t3=l3l2            (10)t_3 = \frac{l_3}{l_2} \;\;\;\;\;\; (10)

that is, the unbiased estimator of the third LL-moment divided by the unbiased estimator of the second LL-moment.

When l.moment.method="plotting.position", the LL-skewness is estimated by:

τ~3=λ~3λ~2            (11)\tilde{\tau}_3 = \frac{\tilde{\lambda}_3}{\tilde{\lambda}_2} \;\;\;\;\;\; (11)

that is, the plotting-position estimator of the third LL-moment divided by the plotting-position estimator of the second LL-moment.

See the help file for lMoment for more information on estimating LL-moments.

Value

A numeric scalar – the sample coefficient of skewness.

Note

Traditionally, the coefficient of skewness has been estimated using product moment estimators. Sometimes an estimate of skewness is used in a goodness-of-fit test for normality (e.g., set
test="skew" in the call to gofTest).

Hosking (1990) introduced the idea of LL-moments and LL-skewness.

Vogel and Fennessey (1993) argue that LL-moment ratios should replace product moment ratios because of their superior performance (they are nearly unbiased and better for discriminating between distributions). They compare product moment diagrams with LL-moment diagrams.

Hosking and Wallis (1995) recommend using unbiased estimators of LL-moments (vs. plotting-position estimators) for almost all applications.

Author(s)

Steven P. Millard (EnvStats@ProbStatInfo.com)

References

Berthouex, P.M., and L.C. Brown. (2002). Statistics for Environmental Engineers, Second Edition. Lewis Publishers, Boca Raton, FL.

Chen, L. (1995). Testing the Mean of Skewed Distributions. Journal of the American Statistical Association 90(430), 767–772.

Helsel, D.R., and R.M. Hirsch. (1992). Statistical Methods in Water Resources Research. Elsevier, New York, NY.

Ott, W.R. (1995). Environmental Statistics and Data Analysis. Lewis Publishers, Boca Raton, FL.

Serfling, R.J. (1980). Approximation Theorems of Mathematical Statistics. John Wiley and Sons, New York, p.73.

Taylor, J.K. (1990). Statistical Techniques for Data Analysis. Lewis Publishers, Boca Raton, FL.

Vogel, R.M., and N.M. Fennessey. (1993). LL Moment Diagrams Should Replace Product Moment Diagrams. Water Resources Research 29(6), 1745–1752.

Zar, J.H. (2010). Biostatistical Analysis. Fifth Edition. Prentice-Hall, Upper Saddle River, NJ.

See Also

var, sd, cv, kurtosis, summaryFull, Summary Statistics.

Examples

  # Generate 20 observations from a lognormal distribution with parameters 
  # mean=10 and cv=1, and estimate the coefficient of skewness. 
  # (Note: the call to set.seed simply allows you to reproduce this example.)

  set.seed(250) 

  dat <- rlnormAlt(20, mean = 10, cv = 1) 

  skewness(dat) 
  #[1] 0.9876632
 
  skewness(dat, method = "moment") 
  #[1] 0.9119889
 
  skewness(dat, meth = "l.moment") 
  #[1] 0.2656674

  #----------
  # Clean up
  rm(dat)

[Package EnvStats version 2.8.1 Index]