Lcomoment.Lk12 | R Documentation |
Compute the L-comoment (\lambda_{k[12]}
) for a given pair of sample of n
random variates \{(X_i^{(1)}, X_i^{(1)}), 1 \le i \le n \}
from a joint distribution H(x^{(1)}, x^{(2)})
with marginal distribution functions F_1
and F_2
. When the X^{(2)}
are sorted to form the sample order statistics X^{(2)}_{1:n} \le X^{(2)}_{2:n} \le \cdots \le X^{(2)}_{n:n}
, then the element of X^{(1)}
of the unordered (at leasted expected to be) but shuffled set \{X^{(1)}_1, \ldots, X^{(1)}_n\}
that is paired with X^{(2)}_{r:n}
the concomitant X^{(12)}_{[r:n]}
of X^{(2)}_{r:n}
. (The shuffling occurs by the sorting of X^{(2)}
.) The k \ge 1
-order L-comoments are defined (Serfling and Xiao, 2007, eq. 26) as
\hat\lambda_{k[12]} = \frac{1}{n}\sum_{r=1}^n w^{(k)}_{r:n} X^{(12)}_{[r:n]}\mbox{,}
where w^{(k)}_{r:n}
is defined under Lcomoment.Wk
. (The author is aware that k \ge 1
is k \ge 2
in Serfling and Xiao (2007) but k=1
returns sample means. This matters only in that the lmomco package returns matrices for k \ge 1
by Lcomoment.matrix
even though the off diagnonals are NAs
.)
Lcomoment.Lk12(X1,X2,k=1)
X1 |
A vector of random variables (a sample of random variable 1). |
X2 |
Another vector of random variables (a sample of random variable 2). |
k |
The order of the L-comoment to compute. The default is 1. |
Now directing explanation of L-comoments with some reference heading into R code. L-comoments of random variable X1
(a vector) are computed from the concomitants of X2
(another vector). That is, X2
is sorted in ascending order to create the order statistics of X2
. During the sorting process, X1
is reshuffled to the order of X2
to form the concomitants of X2
(denoted as X12
). So the trailing 2
is the sorted variable and the leading 1
is the variable that is shuffled. The X12
in turn are used in a weighted summation and expectation calculation to compute the L-comoment of X1
with respect to X2
such as by Lk3.12 <-
Lcomoment.Lk12(X1,X2,k=3)
. The notation of Lk12
is to read “Lambda for kth order L-comoment”, where the 12
portion of the notation reflects that of Serfling and Xiao (2007) and then Asquith (2011). The weights for the computation are derived from calls made by Lcomoment.Lk12
to the weight function Lcomoment.Wk
. The L-comoments of X2
are computed from the concomitants of X1
, and the X21
are formed by sorting X1
in ascending order and in turn shuffling X2
by the order of X1
. The often asymmetrical L-comoment of X2
with respect to X1
is readily done (Lk3.21 <-
Lcomoment.Lk12(X2,X1,k=3)
) and is not necessarily equal to (Lk3.12 <-
Lcomoment.Lk12(X1,X2,k=3)
).
A single L-comoment.
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.Lk12
or similar remains an available name in future releases.
W.H. Asquith
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.Wk
X1 <- rnorm(101); X2 <- rnorm(101) + X1
Lcoskew12 <- Lcomoment.Lk12(X1,X2, k=3)
Lcorr12 <- Lcomoment.Lk12(X1,X2,k=2)/Lcomoment.Lk12(X1,X1,k=2)
rhop12 <- cor(X1, X2, method="pearson")
print(Lcorr12 - rhop12) # smallish number
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.