help for lmoments

L-moments and derived statistics

lmoments
[varlist]
[if exp]
[in range]
[,
allobs
lmax(#)
short
tabdisp_options
variablenames
saving(filename[, save_options)
]

lmoments
varname
[if exp]
[in range]
[,
by(byvarlist)
missing
lmax(#)
short
tabdisp_options
saving(filename[, save_options)
]

by ... : may also be used with lmoments:
see help on by.

Description

lmoments calculates L-moments and derived statistics for
a varlist. Any string variables in varlist are ignored.
Specifically, and by default, the first four L-moments and the derived
statistics t, t_3 and t_4 are calculated for each variable in
varlist.

Remarks

Denote by X(j:n) the j th smallest observation from a sample of
size n from a variable X and by E the expectation operator.

The first four L-moments are defined by

E (X(1:1)),

1/2 E (X(2:2) - X(1:2)),

1/3 E (X(3:3) - 2 X(2:3) + X(1:3)) and

1/4 E (X(4:4) - 3 X(3:4) + 3 X(2:4) - X(1:4)).

They are estimated via these weighted averages for a sample
x_1, ..., x_n, otherwise known as probability-weighted moments:

b_0 = average of x(j:n),

j - 1
b_1 = average of ----- x(j:n),
n - 1

j - 1 j - 2
b_2 = average of ----- ----- x(j:n) and
n - 1 n - 2

j - 1 j - 2 j - 3
b_3 = average of ----- ----- ----- x(j:n).
n - 1 n - 2 n - 3

The estimators are

l_1 = b_0,
l_2 = 2 b_1 - b_0,
l_3 = 6 b_2 - 6 b_1 + b_0 and
l_4 = 20 b_3 - 30 b_2 + 12 b_1 - b_0,

whence

t = l_2 / l_1 (cf. coefficient of variation),
t_3 = l_3 / l_2 (cf. skewness) and
t_4 = l_4 / l_2 (cf. kurtosis).

Options

allobs specifies use of the maximum possible number of
observations for each variable. The default is to use only those
observations for which all variables in varlist are not missing.

by() specifies one or more variables defining distinct
groups for which L-moments should be calculated. by() is allowed
only with a single varname. The choice between by: and
by() is partly one of precisely what kind of output display is
required. The display with by: is clearly structured by groups
while that with by() is more compact. To show L-moments for
several variables and several groups with a single call to
lmoments, the display with by: is essential.

missing specifies that, if by() is specified,
observations with missing values on byvarlist are to be included in
calculations. The default is to exclude them. Missing values on
varlist are always and necessarily ignored.

lmax() specifies calculation of the measures l_5 upwards
to the specified maximum and correspondingly of the measures t_5 upwards
in addition to the default. Thus lmax(8) adds L-moments 5, 6, 7
and 8 and ratios t_5, ..., t_8. See the references for definitions.
Results are not displayed, but may be saved to a new dataset via the
saving() option. This is a rarely specified option for those
exploring the uses of these measures.

short specifies display of n, l_1, l_2, t_3, t_4 only.
This option has no effect on the calculation.

tabdisp_options are options of tabdisp. The
default display has format(%9.3f).

variablenames specifies that the variable names of
varlist should be used in display. The default is to use variable
labels to indicate a set of variables.

saving() specifies a filename in which to save the
results of calculations as a Stata dataset. Optionally, the options of
save itself may be specified.

Examples

. sysuse auto, clear

. lmoments, short

. lmoments price-foreign

. bysort rep78: lmoments mpg

. lmoments mpg, by(rep78) missing

. lmoments mpg, by(rep78) missing saving(lmoresults, replace)

Saved results

(all for last-named variable or group only)

r(N) n
r(l_1) l_1
r(l_2) l_2
r(l_3) l_3
r(l_4) l_4
... (higher sample L-moments if requested)
r(t) t
r(t_3) t_3
r(t_4) t_4
... (higher sample L-moment ratios if requested)

Acknowledgments

lmoments is a descendant of Patrick Royston's lshape program.
Stephen Jenkins found a bug in a previous version of this program.

Author

Nicholas J. Cox, Durham University, U.K.

n.j.cox@durham.ac.uk

References

L-moments

Hosking, J.R.M. 1990. L-moments: Analysis and estimation of
distributions using linear combinations of order statistics.
Journal of the Royal Statistical Society Series B 52: 105-124.

Hosking, J.R.M. 1998. L-moments. In Kotz, S., C.B. Read and
D.L. Banks (eds) Encyclopedia of Statistical Sciences Update Volume 2.
New York: Wiley, 357-362.

Hosking, J.R.M. 2006.
On the characterization of distributions by their L-moments.
Journal of Statistical Planning and Inference
136: 193-198.

Hosking, J.R.M. and J.R. Wallis. 1997.
Regional frequency analysis: an approach based on L-moments.
Cambridge University Press.

Jones, M.C. 2004.
On some expressions for variance, covariance, skewness and L-moments.
Journal of Statistical Planning and Inference
126: 97-106.

Royston, P. 1992.
Which measures of skewness and kurtosis are best?
Statistics in Medicine 11: 333-343.

Serfling, R. and Xiao, P. 2007.
A contribution to multivariate L-moments: L-comoment matrices.
Journal of Multivariate Analysis 98: 1765-1781.

See also

lmose (if installed)