Learn R Programming

copBasic (version 1.7.1)

rhoCOP: The Spearman's Rho of a Copula

Description

Compute the measure of association known as Spearman's 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 for $p = 1$ and $k_p(p= 1) = 12$ is generalized under hoefCOP. Depending on copula family (Joe, 2015, 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 (2015, 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 pure independence $\mathbf{\Pi} = uv$. Nelsen (2006, pp. 175--176) observes 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"),
                            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);
brute
Should brute force be used instead of two nested integrate() functions in Rto 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.

References

Joe, H., 2015, 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, giniCOP, hoefCOP, tauCOP, wolfCOP

Examples

Run this code
rhoCOP(cop=PSP)             # 0.4784176
rhoCOP(cop=PSP, brute=TRUE) # 0.4684063
# CPU heavy example showing that the dual-integration (fast) results in
# a Spearman's Rho that mimics a sample version
dorho <- function(n) {
   uv <- simCOP(n=n, cop=PSP, ploton=FALSE, points=FALSE)
   return(cor(uv$U, uv$V, method="spearman"))
}
rhos <- replicate(100, dorho(1000))
rho.sample <- mean(rhos); print(rho.sample) # 0.472661
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
# 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's Rho from the alternative formulations from Joe (2015).
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 (2015, 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 (2015)
   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

Run the code above in your browser using DataLab