# Lcomoment.correlation: L-correlation Matrix (L-correlation through Sample... In lmomco: L-Moments, Censored L-Moments, Trimmed L-Moments, L-Comoments, and Many Distributions

 Lcomoment.correlation R Documentation

## L-correlation Matrix (L-correlation through Sample L-comoments)

### Description

Compute the L-correlation from an L-comoment matrix of order k = 2. This function assumes that the 2nd order matrix is already computed by the function `Lcomoment.matrix`.

### Usage

```Lcomoment.correlation(L2)
```

### Arguments

 `L2` A k = 2 L-comoment matrix from `Lcomoment.matrix(Dataframe,k=2)`.

### Details

L-correlation is computed by `Lcomoment.coefficients(L2,L2)` where `L2` is second order L-comoment matrix. The usual L-scale values as seen from `lmom.ub` or `lmoms` are along the diagonal. This function does not make use of `lmom.ub` or `lmoms` and can be used to verify computation of τ (coefficient of L-variation).

### Value

An R `list` is returned.

 `type` The type of L-comoment representation in the matrix: “Lcomoment.coefficients”. `order` The order of the matrix—extracted from the first matrix in arguments. `matrix` A k ≥ 2 L-comoment coefficient matrix.

### Note

The function begins with a capital letter. This is intentionally done so that lower case namespace is preserved. By using a capital letter now, then `lcomoment.correlation` remains an available name in future releases.

W.H. Asquith

### References

Asquith, W.H., 2011, Distributional analysis with L-moment statistics using the R environment for statistical computing: Createspace Independent Publishing Platform, ISBN 978–146350841–8.

Serfling, R., and Xiao, P., 2007, A contribution to multivariate L-moments—L-comoment matrices: Journal of Multivariate Analysis, v. 98, pp. 1765–1781.

`Lcomoment.matrix`, `Lcomoment.correlation`

### Examples

```D   <- data.frame(X1=rnorm(30), X2=rnorm(30), X3=rnorm(30))
L2  <- Lcomoment.matrix(D,k=2)
RHO <- Lcomoment.correlation(L2)
## Not run:
"SerfXiao.eq17" <-
function(n=25, A=10, B=2, k=4,
method=c("pearson","lcorr"), wrt=c("12", "21")) {
method <- match.arg(method); wrt <- match.arg(wrt)
# X1 is a linear regression on X2
X2 <- rnorm(n); X1 <- A + B*X2 + rnorm(n)
r12p <- cor(X1,X2) # Pearson's product moment correlation
XX <- data.frame(X1=X1, X2=X2) # for the L-comoments
T2 <- Lcomoment.correlation(Lcomoment.matrix(XX, k=2))\$matrix
LAMk <- Lcomoment.matrix(XX, k=k)\$matrix # L-comoments of order k
if(wrt == "12") { # is X2 the sorted variable?
lmr <- lmoms(X1, nmom=k); Lamk <- LAMk[1,2]; Lcor <- T2[1,2]
} else {          # no X1 is the sorted variable (21)
lmr <- lmoms(X2, nmom=k); Lamk <- LAMk[2,1]; Lcor <- T2[2,1]
}
# Serfling and Xiao (2007, eq. 17) state that
# L-comoment_k = corr.coeff * Lmoment_k or
# L-comoment_k = corr.coeff * Lmoment_k
# And with the X1, X2 setup above, Pearson corr. == L-corr.
# There will be some numerical differences for any given sample.
ifelse(method == "pearson",
return(lmr\$lambdas[k]*r12p - Lamk),
return(lmr\$lambdas[k]*Lcor - Lamk))
# If the above returns a expected value near zero then, their eq.
# is numerically shown to be correct and the estimators are unbiased.
}

# The means should be near zero.
nrep <- 2000; seed <- rnorm(1); set.seed(seed)
mean(replicate(n=nrep, SerfXiao.eq17(method="pearson", k=4)))
set.seed(seed)
mean(replicate(n=nrep, SerfXiao.eq17(method="lcorr", k=4)))
# The variances should nearly be equal.
seed <- rnorm(1); set.seed(seed)
var(replicate(n=nrep, SerfXiao.eq17(method="pearson", k=6)))
set.seed(seed)
var(replicate(n=nrep, SerfXiao.eq17(method="lcorr", k=6)))

## End(Not run)
```

lmomco documentation built on Aug. 27, 2022, 1:06 a.m.