rhoCOP {copBasic}R Documentation

The Spearman Rho of a Copula

Description

Compute the measure of association known as the Spearman Rho \rho_\mathbf{C} of a copula according to Nelsen (2006, pp. 167–170, 189, 208) by

\rho_\mathbf{C} = 12\int\!\!\int_{\mathcal{I}^2} \mathbf{C}(u,v)\, \mathrm{d}u\mathrm{d}v - 3\mbox{,}

or

\rho_\mathbf{C} = 12\int\!\!\int_{\mathcal{I}^2} [\mathbf{C}(u,v) - uv]\, \mathrm{d}u\mathrm{d}v\mbox{,}

where the later equation is implemented by rhoCOP as the default method (method="default"). This equation, here having p = 1 and k_p(1) = 12, is generalized under hoefCOP. The absence of the 12 in the above equation makes it equal to the covariance defined by the Hoeffding Identity (Joe, 2014, p. 54):

\mathrm{cov}(U, V) = \int\!\!\int_{\mathcal{I}^2} [\mathbf{C}(u,v) - uv]\, \mathrm{d}u\mathrm{d}v\mbox{ or}

\mathrm{cov}(U, V) = \int\!\!\int_{\mathcal{I}^2} [\hat{\mathbf{C}}(u,v) - uv]\, \mathrm{d}u\mathrm{d}v\mbox{, which is}

\mathrm{cov}(U, V) = \int\!\!\int_{\mathcal{I}^2} [u+v-1+\mathbf{C}(1-u,1-v) - uv]\, \mathrm{d}u\mathrm{d}v\mbox{.}

Depending on copula family (Joe, 2014, pp. 56 and 267), the alternative formulation for \rho_\mathbf{C} could be used

\rho_\mathbf{C} = 3 - 12\int\!\!\int_{\mathcal{I}^2} u \frac{\delta\mathbf{C}(u,v)}{\delta u} \, \mathrm{d}u\mathrm{d}v = 3 - 12\int\!\!\int_{\mathcal{I}^2} v\frac{\delta\mathbf{C}(u,v)}{\delta v} \, \mathrm{d}u\mathrm{d}v\mbox{,}

where the first integral form corresponds to Joe (2014, eq. 248, p. 56) and is the method="joe21", and the second integral form is the method="joe12".

The integral

\int\!\!\int_{\mathcal{I}^2} \mathbf{C}(u,v)\,\mathrm{d}u\mathrm{d}v\mbox{,}

represents the “volume under the graph of the copula and over the unit square” (Nelsen, 2006, p. 170) and therefore \rho_\mathbf{C} is simple a rescaled volume under the copula. The second equation for \rho_\mathbf{C} expresses the “average distance” between the joint distribution and statistical independence \mathbf{\Pi} = uv. Nelsen (2006, pp. 175–176) shows that the following relation between \rho_\mathbf{C} and \tau_\mathbf{C} (tauCOP) exists

-1 \le 3\tau - 2\rho \le 1\mbox{.}

Usage

rhoCOP(cop=NULL, para=NULL, method=c("default", "joe21", "joe12"),
                            as.sample=FALSE, brute=FALSE, delta=0.002, ...)

Arguments

cop

A copula function;

para

Vector of parameters or other data structure, if needed, to pass to the copula;

method

The form of integration used to compute (see above);

as.sample

A logical controlling whether an optional R data.frame in para is used to compute the \hat\rho by dispatch to cor() function in R with method = "spearman";

brute

Should brute force be used instead of two nested integrate() functions in R to perform the double integration;

delta

The \mathrm{d}u and \mathrm{d}v for the brute force integration using brute; and

...

Additional arguments to pass.

Value

The value for \rho_\mathbf{C} is returned.

Note

Technically, Nelsen (2006) also shows that these definitions are a form of call to a concordance function \mathcal{Q}(\mathbf{C}_1,\mathbf{C}_2) of two copulas that involve \mathbf{C}_1{=}\mathbf{C}(u,v) and \mathbf{C}_2{=}\mathbf{\Pi}. As such in order to keep rhoCOP a small function when brute=TRUE, \rho_\mathbf{C} is computed by a special call to tauCOP, which by itself and although titled for computation of Kendall Tau, does support the concordance function \mathcal{Q}(\mathbf{C}_1, \mathbf{C}_2) [see Nelsen (2006, pp. 158–159)] when given two different copulas and respective parameters as arguments. The well-known Pearson correlation coefficient equals Spearman rho value if random variables X and Y are both uniformly distributed on [0,1].

Author(s)

W.H. Asquith

References

Joe, H., 2014, Dependence modeling with copulas: Boca Raton, CRC Press, 462 p.

Nelsen, R.B., 2006, An introduction to copulas: New York, Springer, 269 p.

See Also

blomCOP, footCOP, giniCOP, hoefCOP, tauCOP, wolfCOP, joeskewCOP, uvlmoms

Examples

rhoCOP(cop=PSP)             # 0.4784176
## Not run: 
rhoCOP(cop=PSP, brute=TRUE) # 0.4684063
# CPU heavy example showing that the dual-integration (fast) results in
# a Spearman Rho that mimics a sample version
do_rho <- function(n) {
   uv <- simCOP(n=n, cop=PSP, ploton=FALSE, points=FALSE)
   return(cor(uv$U, uv$V, method="spearman"))
}
rhos <- replicate(100, do_rho(1000))
rho_sample <- mean(rhos); print(rho_sample) # 0.472661
## End(Not run)

## Not run: 
para <- list(cop1=PLACKETTcop,  cop2=PLACKETTcop,
             para1=0.00395,    para2=4.67,     alpha=0.9392, beta=0.5699)
rhoCOP(cop=composite2COP, para=para) # -0.5924796

para <- list(cop1=PLACKETTcop,  cop2=PLACKETTcop,
             para1=0.14147,    para2=20.96,    alpha=0.0411, beta=0.6873)
rhoCOP(cop=composite2COP, para=para) # 0.2818874

para <- list(cop1=PLACKETTcop,  cop2=PLACKETTcop,
             para1=0.10137,     para2=4492.87, alpha=0.0063, beta=0.0167)
rhoCOP(cop=composite2COP, para=para)             # 0.9812919
rhoCOP(cop=composite2COP, para=para, brute=TRUE) # 0.9752155
## End(Not run)

## Not run: 
# This is the same composited copula used in a highly asymmetric multi-modal
# plotting example under densityCOPplot(). Let us use that copula as a means to
# check on the Spearman Rho from the alternative formulations from Joe (2014).
para <- list(alpha=0.15, beta=0.90, kappa=0.06, gamma=0.96,
             cop1=GHcop, cop2=PLACKETTcop, para1=5.5, para2=0.07)
"rhoCOPbyJoe21" <- function(cop=NULL, para=NULL, ...) { # Joe (2014, eq. 2.48)
   myint <- NULL
   try(myint <- integrate(function(u) {
       sapply(u,function(u) { integrate(function(v) {
       u * derCOP( u, v, cop=cop, para=para, ...)},  0, 1)$value })}, 0, 1))
   ifelse(is.null(myint), return(NA), return(3 - 12*myint$value))
}
"rhoCOPbyJoe12" <- function(cop=NULL, para=NULL, ...) { # Not in Joe (2014)
   myint <- NULL
   try(myint <- integrate(function(u) {
       sapply(u,function(u) { integrate(function(v) {
       v * derCOP2( u, v, cop=cop, para=para, ...)}, 0, 1)$value })}, 0, 1))
   ifelse(is.null(myint), return(NA), return(3 - 12*myint$value))
}
rhoCOP(       cop=composite2COP, para=para) # 0.1031758
rhoCOPbyJoe21(cop=composite2COP, para=para) # 0.1031803
rhoCOPbyJoe12(cop=composite2COP, para=para) # 0.1031532
## End(Not run)

[Package copBasic version 2.2.4 Index]