samlmu {lmom} | R Documentation |
Sample L-moments
Description
Computes the “unbiased” sample (trimmed) L
-moments
and L
-moment ratios of a data vector.
Usage
samlmu(x, nmom=4, sort.data=TRUE, ratios=sort.data, trim=0)
samlmu.s(x, nmom=4, sort.data=TRUE, ratios=sort.data, trim=0)
.samlmu(x, nmom=4)
Arguments
x |
A numeric vector. |
nmom |
Number of |
sort.data |
Logical: whether the |
ratios |
Logical. If |
trim |
Degree of trimming.
If a single value, symmetric trimming of the specified degree will be used.
If a vector of length 2, the two values
indicate the degrees of trimming at the lower and upper ends of the
“conceptual sample” (Elamir and Seheult, 2003) of order statistics
that is used to define the trimmed |
Details
samlmu
and samlmu.s
are functionally identical.
samlmu
calls a Fortran routine internally, and is usually faster.
samlmu.s
is written entirely in the S language; it is provided
so that users can conveniently see how the calculations are done.
.samlmu
is a “bare-bones” version for use in programming.
It gives an error if x
contains missing values,
computes L
-moment ratios and not L
-moments,
does not give a warning if all the elements of x
are equal,
and returns its result in an unnamed vector.
Sample L
-moments are defined in Hosking (1990).
Calculations use the algorithm given in Hosking (1996, p.14).
Trimmed sample L
-moments are defined as in Hosking (2007), eq. (15)
(a small extension of Elamir and Seheult (2003), eq. (16)).
They are calculated from the untrimmed sample L
-moments
using the recursions of Hosking (2007), eqs. (12)-(13).
Value
If ratios
is TRUE
, a numeric vector containing
the L
-moments and L
-moment ratios,
in the order \ell_1
, \ell_2
, t_3
, t_4
, etc.
If ratios
is FALSE
, a numeric vector containing the L
-moments
in the order \ell_1
, \ell_2
, \ell_3
, \ell_4
, etc.
Note
The term “trimmed” is used in a different sense from
its usual meaning in robust statistics.
In particular, the first trimmed L
-moment is in general not equal to
any trimmed mean of the data sample.
Author(s)
J. R. M. Hosking jrmhosking@gmail.com
References
Elamir, E. A. H., and Seheult, A. H. (2003). Trimmed L-moments. Computational Statistics and Data Analysis, 43, 299-314.
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. (1996).
Fortran routines for use with the method of L
-moments, Version 3.
Research Report RC20525, IBM Research Division, Yorktown Heights, N.Y.
Hosking, J. R. M. (2007). Some theory and practical uses of trimmed L-moments. Journal of Statistical Planning and Inference, 137, 3024-3039.
Examples
data(airquality)
samlmu(airquality$Ozone, 6)
# Trimmed L-moment ratios
samlmu(airquality$Ozone, trim=1)