
Last chance! 50% off unlimited learning
Sale ends in
The density of copula $\mathbf{C}(u,v)$ is numerically estimated by
densityCOP
). Given a numerically estimated quantity $c^\star(u,v) = c(u,v)\times\phi(\Phi^{(-1)}(u))\times\phi(\Phi^{(-1)}(v))$ for copula density $c(u,v)$, a grid of the $c^\star(u,v)$ values can be contoured by the contour()
function in R. The density function of the N(0,1) is $\phi(z)$ for standard normal variate $z$ and the quantile function of the N(0,1) is $\Phi^{(-1)}(t)$ for nonexceedance probability $t$.
A grid (matrix) of $c(u,v)$ or $c^\star(u,v)$ is defined for sequence of $u$ and $v$ probabilities for which each sequence has equal steps that are equal to $\Delta(uv)$. This function has as focus on plotting of the contour lines of $c^\star(u,v)$ but the Rmatrix
of either $c(u,v)$ or $c^\star(u,v)$ can be requested on return. For either matrix, the colnames()
and rownames()
(the Rfunctions) are set equal to the sequence of $u$ and $v$, respectively. Neither the column or row names are set to the standard normal variates for the matrix of $c^\star(u,v)$, the names remain in terms of nonexceedance probability.
For plotting and other uses of normal scores of data, Joe (2014, p. 245) advocates that one should use the plotting position formula $u_i = (i-1/2)/n$ (Hazen plotting position) for normal scores $z_i = \Phi^{-1}(u_i)$ in preference to $i/(n+1)$ (Weibull plotting position) because $n^{-1}\sum_{i=1}^{n} z^2_i$ is closer to unity. Other places of Joe's advocation for the Hazen plotting positions are available (Joe, 2014, pp. 9, 17, 245, 247--248).
densityCOPplot(cop=NULL, para=NULL, deluv=0.002, origins=TRUE,
getmatrix=c("none", "cdenzz", "cden"), n=0,
ploton=TRUE, contour.col=1, ...)
cdenzz
returns the density scaled by the two standard normal densities ($c^\star(u,v)$), whereas the option cden
returns simply the copula density ($c(u,v)$);col
argument of the contour
function in R;simCOP
and drawn; andcontour
function in R(e.g. to turn off labeling of contours add drawlabels=FALSE
).matrix
can be triggered, however, as a returned value.Nelsen, R.B., 2006, An introduction to copulas: New York, Springer, 269 p.
simCOP
, densityCOP
# Joe (2014, p. 5) names rMTCJ = reflected Mardia-Takahasi-Cook-Johnson copula
"rMTCJ" <- function(u,v,para, ...) {
u + v - 1 + ((1-u)^(-para) + (1-v)^(-para) - 1)^(-1/para)
} # Survial Copula ("reflected" in Joe's terms)
densityCOPplot(cop=rMTCJ, para=1.0760, n=9000)
# The density plot matches that shown by Joe (2014, p. 11, fig. 1.2, lower left plot)
# for a Spearman's Rho equaling 0.5.
rhoCOP(cop=rMTCJ, para=1.076075) # 0.4999958
# Now let us get really wild with a composition with TWO modes!
# This example also proves that the orientation of the grid is consistent with
# orientation of the simulations.
para <- list(alpha=0.15, beta=0.90, kappa=0.06, gamma=0.96,
cop1=GHcop, cop2=PLACKETTcop, para1=5.5, para2=0.07)
densityCOPplot(cop=composite2COP, para=para, n=9000)
# Now let us hack back to a contour density plot with U(0,1) and not N(0,1)
# margins just so show that capability exists, but emphasis of densityCOPplot
# is clearly on Joe's advocation so it does not have a trigger to use U(0,1)
# margins.
set.seed(12)
H <- densityCOPplot(cop=PLACKETTcop, para=41.25, getmatrix="cden", n=1000)
set.seed(12)
UV <- simCOP(cop=PLACKETTcop, para=41.25, n=1000, col=8)
U <- as.numeric(colnames(H)); V <- as.numeric(rownames(H))
contour(x=U, y=V, z=t(H), lwd=1.5, cex=2, add=TRUE, col=2)
Run the code above in your browser using DataLab