.-
help for ^lmoments^
.-

L-moments and derived statistics
--------------------------------

    ^lmoments^ [varlist] [^if^ exp] [^in^ range]
    [, ^d^etail ^m^atname^(^matrix_name^)^ tabdisp_options]

    ^lmoments^ varname [^if^ exp] [^in^ range] [^, by(^byvar^)^
    ^d^etail ^m^atname^(^matrix_name^)^ tabdisp_options]


Description
-----------

^lmoments^ calculates L-moments and derived statistics.

There are two syntaxes.

For a varlist with two or more variables, the first four L-moments and
the derived statistics t, t_3 and t_4 are calculated for each variable.

For a varlist with just one variable, the first four L-moments and the
derived statistics t, t_3 and t_4 are calculated for each group
specified.

Options
-------

^by(^byvar^)^ specifies a single variable defining separate groups for
    calculation. It is allowed only with a single variable in varlist.

^detail^ adds n, l_3 and l_4 to the default display of l_1, l_2, t, t_3
   and t_4.

^matname(^matrix_name^)^ specifies the name of a matrix in which to save
    the results of calculations. There will be r rows and 8 columns,
    where r is the number of variables or groups. The columns will
    include n, l_1, l_2, l_3, l_4, t, t_3 and t_4. Saving to a matrix
    will not work if n < 4 or l_1 == 0 or l_2 == 0, or if the number of
    variables or groups is greater than ^matsize^.

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


Remarks
-------

Denote by X(k:n) the k 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))

     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)
                      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
    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)
   t_4 = l_4 / l_2        (cf. kurtosis)


Examples
--------

    . ^lmoments price mpg^
    . ^lmoments mpg, by(rep78)^

    . ^lmoments a b c d, m(lmstat)^
    . ^svmat lmstat, names(col)^


Saved results (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
    r(t)     t
    r(t_3)   t_3
    r(t_4)   t_4


Acknowledgment
--------------

         ^lmoments^ includes code from Patrick Royston's ^lshape^
         program.


Author
------

         Nicholas J. Cox, University of Durham, U.K.
         n.j.cox@@durham.ac.uk


References
----------

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-24.

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

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