skewness(x, na.rm = FALSE, method = "fisher", l.moment.method = "unbiased",
plot.pos.cons = c(a = 0.35, b = 0))
x
.
If na.rm=FALSE
(the default) and x
contains missing values,
then a missing value (NA
) is returned. If na.rm=TRUE
,"fisher"
(ratio of unbiased moment estimators; the default),
"moments"
(ratio of product moment esmethod="l.moments"
. The possible values are
"ubiased"
(method based on the $U$-statistic; the default), or
"plotting.position"
method="l.moments"
and
l.moment.method="plotting.position"
. The default value is
plot.pos.cons=c(a=0.35, b
method="moment"
or method="fisher"
)
The coefficient of skewness of a distribution is the third
standardized moment about the mean:
$$\eta_3 = \sqrt{\beta_1} = \frac{\mu_3}{\sigma^3} \;\;\;\;\;\; (1)$$
where
$$\eta_r = E[(\frac{X-\mu}{\sigma})^r] = \frac{1}{\sigma^r} E[(X-\mu)^r] = \frac{\mu_r}{\sigma^r} \;\;\;\;\;\; (2)$$
and
$$\mu_r = E[(X-\mu)^r] \;\;\;\;\;\; (3)$$
denotes the $r$'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:
$$\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
$$\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.
$$\hat{\eta}_3 = \frac{\frac{n}{(n-1)(n-2)} \sum_{i=1}^n (x_i - \bar{x})^3}{s^3} \;\;\;\;\;\; (7)$$
where
$$\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 $L$-moment analog of the coefficient of skewness as:
$$\tau_3 = \frac{\lambda_3}{\lambda_2} \;\;\;\;\;\; (9)$$
that is, the third $L$-moment divided by the second $L$-moment. He shows
that this quantity lies in the interval (-1, 1).
When l.moment.method="unbiased"
, the $L$-skewness is estimated by:
$$t_3 = \frac{l_3}{l_2} \;\;\;\;\;\; (10)$$
that is, the unbiased estimator of the third $L$-moment divided by the
unbiased estimator of the second $L$-moment.
When l.moment.method="plotting.position"
, the $L$-skewness is estimated by:
$$\tilde{\tau}_3 = \frac{\tilde{\lambda}_3}{\tilde{\lambda}_2} \;\;\;\;\;\; (11)$$
that is, the plotting-position estimator of the third $L$-moment divided by the
plotting-position estimator of the second $L$-moment.
See the help file for lMoment
for more information on
estimating $L$-moments.var
, sd
, cv
,
kurtosis
, summaryFull
,
Summary Statistics.# 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)
Run the code above in your browser using DataLab