TLmoms: The Sample Trimmed L-moments and L-moment Ratios

TLmomsR Documentation

The Sample Trimmed L-moments and L-moment Ratios

Description

Compute the sample trimmed L-moments (TL-moments) for a vector. The level of symmetrical trimming is specified. The mathematical expression for a TL-moment is seen under TLmom. The TLmoms function loops across that expression and the TLmom function for each nmom=r set in the argument list.

Usage

TLmoms(x, nmom, trim=NULL, leftrim=NULL, rightrim=NULL, vecit=FALSE)

Arguments

x

A vector of data values.

nmom

The number of moments to compute. Default is 5.

trim

Level of symmetrical trimming to use in the computations. Although NULL is in the argument list, the default is 0—the usual L-moment is returned.

leftrim

Level of trimming of the left-tail of the sample, which should be left to NULL if no or symmetrical trimming is used.

rightrim

Level of trimming of the right-tail of the sample, which should be left to NULL if no or symmetrical trimming is used.

vecit

A logical to return the first two \lambda_i \in 1,2 and then the \tau_i \in 3,\cdots where the length of the returned vector is controlled by the nmom argument. This argument will store the trims in the attributes of the returned vector, but caution is advised if vec2par were to be used on the vector because that function does not consult the trimming.

Value

An R list is returned.

lambdas

Vector of the TL-moments. First element is \hat{\lambda}^{(t_1,t_2)}_1, second element is \hat{\lambda}^{(t_1,t_2)}_2, and so on.

ratios

Vector of the L-moment ratios. Second element is \hat{\tau}^{(t_1,t_2)}, third element is \hat{\tau}^{(t_1,t_2)}_3 and so on.

trim

Level of symmetrical trimming used in the computation.

leftrim

Level of left-tail trimming used in the computation, which will equal trim if symmetrical trimming was used.

rightrim

Level of right-tail trimming used in the computation, which will equal trim if symmetrical trimming was used.

source

An attribute identifying the computational source of the L-moments: “TLmoms”.

Author(s)

W.H. Asquith

References

Elamir, E.A.H., and Seheult, A.H., 2003, Trimmed L-moments: Computational Statistics and Data Analysis, v. 43, pp. 299–314.

See Also

TLmom, lmoms, and lmorph

Examples

X1 <- rcauchy(30)
TL <- TLmoms(X1,nmom=6,trim=1)

# This trimming with remove the 1 and the two 4s. All values passed on to the TLmom()
# function then are equal and number of L-moments is too big as well. TLmom() returns
# NaN but these are intercepted and systematically changed to NAs.
TLmoms(c(1,2,2,2,4,4), leftrim=1, rightrim=2, nmom=6)$lambdas
# [1]  2  0  0 NA NA NA

# Example of zero skewness (Berry Boessenkool)
TLmoms(c(3.2, 4.4, 4.8, 2.6, 3.6))

wasquith/lmomco documentation built on Nov. 13, 2024, 4:53 p.m.