lmoms.cov {lmomco} | R Documentation |
Distribution-Free Variance-Covariance Structure of Sample L-moments
Description
Compute the distribution-free, variance-covariance matrix () of the sample L-moments (
) or alternatively the sample probability-weighted moments (
, Elamir and Seheult, 2004, sec. 5). The
is defined by the matrix product
where the matrix
for number of moments
represents the coefficients of the linear combinations converting
to
and the
th row in the matrix is defined as
where the row is padded from the right with zeros for to form the required lower triangular structure. Elamir and Seheult (2004) list the
matrix for
.
Letting the falling factorial be defined (matching Elamir and Seheult's nomenclature) as
and letting an entry in the matrix denoted as
be defined as
where are again the sample probability-weighted moments and are computed by
pwm
, and finally is defined as
where are the sample order statistics for a sample of size
.
Incidentally, the matrix is the variance-covariance structure (
) of the
, thus
, which can be returned by a logical function argument (
as.pwm=TRUE
) instead of . The last example in Examples provides a demonstration.
Usage
lmoms.cov(x, nmom=5, as.pwm=FALSE, showC=FALSE,
se=c("NA", "lamse", "lmrse", "pwmse"), ...)
Arguments
x |
A vector of data values. |
nmom |
The number of moments to compute. Default is 5. |
as.pwm |
A logical controlling whether the distribution-free, variance-covariance of sample probability-weighted moments ( |
showC |
A logical controlling whether the matrix |
se |
Compute standard errors ( |
... |
Other arguments to pass should they be needed (none were at first implementation). |
Value
An R matrix
is returned. In small samples and substantially sized , one or more
will be
NaN
starting from the lower right corner of the matrix. The function does not test for this nor reduce the number of moments declared in nmom
itself. To reiterate, the square roots along the diagonal are
for the respective L-moments.
Note
Function lmoms.cov
was developed as a double check on the evidently separately developed (
nmom
) implementations of in packages Lmoments and nsRFA. Also the internal structure closely matches the symbolic mathematics by Elamir and Seheult (2004), but this practice comes at the expense of more than an order of magnitude slower execution times than say either of the functions
Lmomcov()
(package Lmoments) or varLmoments()
(package nsRFA). For a high speed and recommended implementation, please use the Lmoments package by Karvanen (2016)—Karvanen extended this implementation to larger for the lmomco package.
For se="lmrse"
, the Taylor-series-based approximation is suggested by Elamir and Seheult (2004, p. 348) to estimate the variance of an L-moment ratio ( for
) is based on structure of the variance of the ratio of two uniform variables in which the numerator is the
th L-moment and the denominator is
:
where are the along the diagonal of
and
are the off-diagonal covariances. The expectations
are replaced with the sample estimates. Only for
se="lmrse"
the of the coefficient of L-variation (
) is computed but retained as an attribute (
attr()
function) of the returned vector and not housed within the vector—the continues to be held in the 2nd position of the returned vector.
Author(s)
W.H. Asquith
References
Elamir, E.A.H., and Seheult, A.H., 2004, Exact variance structure of sample L-moments: Journal of Statistical Planning and Inference, v. 124, pp. 337–359.
Karvanen, Juha, 2016, Lmoments—L-moments and quantile mixtures: R package version 1.2-3, accessed February 22, 2016 at https://cran.r-project.org/web/packages/Lmoments/index.html
See Also
Examples
## Not run:
nsim <- 1000; n <- 10 # Let us compute variance of lambda_3
VL3sample <- mean(replicate(nsim, { zz <- lmoms.cov(rexp(n),nmom=3); zz[3,3] }))
falling.factorial <- function(a, b) gamma(b+1)*choose(a,b)
VL3exact <- ((4*n^2 - 3*n - 2)/30)/falling.factorial (10, 3) # Exact variance is from
print(c(VL3sample, VL3exact)) # Elamir and Seheult (2004, table 1, line 8)
#[1] 0.01755058 0.01703704 # the values obviously are consistent
## End(Not run)
## Not run:
# Data considered by Elamir and Seheult (2004, p. 348)
library(MASS); data(michelson); Light <- michelson$Speed
lmoms(Light, nmom=4)$lambdas # 852.4, 44.3, 0.83, 6.5 # matches those authors
lmoms.cov(Light) # [1, ] ==> 62.4267, 0.7116, 2.5912, -3.9847 # again matches
# The authors report standard error of L-kurtosis as 0.03695, which matches
lmoms.cov(Light, se="lmrse")[4] # 0.03695004
## End(Not run)
## Not run:
D <- rnorm(100) # Check results of Lmoments package.
lmoms.cov(D, rmax=5)[,5]
# lam1 lam2 lam3 lam4 lam5
#3.662721e-04 3.118812e-05 5.769509e-05 6.574662e-05 1.603578e-04
Lmoments::Lmomcov(D, rmax=5)[,5]
# L1 L2 L3 L4 L5
#3.662721e-04 3.118812e-05 5.769509e-05 6.574662e-05 1.603578e-04
## End(Not run)