Computes the “unbiased” sample (trimmed) \(L\)-moments and \(L\)-moment ratios of a data vector.
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)
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.
A numeric vector.
Number of \(L\)-moments to be found.
Logical: whether the x
vector needs to be sorted.
Logical. If FALSE
, \(L\)-moments are computed;
if TRUE
(the default), \(L\)-moment ratios are computed.
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 \(L\)-moments.
J. R. M. Hosking jrmhosking@gmail.com
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).
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.
data(airquality)
samlmu(airquality$Ozone, 6)
# Trimmed L-moment ratios
samlmu(airquality$Ozone, trim=1)
Run the code above in your browser using DataLab