Learn R Programming

copBasic (version 2.2.6)

densityCOPplot: Contour Density Plot of a Copula

Description

Generate a contour density plot after the advocation of Joe (2014, pp. 9--15). Such graphics are plots of scaled copula densities (\(c^\star(u,v)\), bivariate herein) that are copula densities scaled to the standard normal distribution \(\sim\) N(0,1) margins. Joe (2014) repeatedly emphasizes such plots in contrast to the uniform distribution \(\sim\) U(0,1) margins. Nelsen (2006) does not discuss such scaling but seemingly Nelsen's objectives for his book were somewhat different.

The density of copula \(\mathbf{C}(u,v)\) is numerically estimated by $$c(u,v) = \bigl[\mathbf{C}(u_2,v_2) - \mathbf{C}(u_2,v_1) - \mathbf{C}(u_1,v_2) + \mathbf{C}(u_1,v_1)\bigr]\, /\, \bigl[\Delta(uv)\times\Delta(uv)\bigr]\mbox{,}$$ where \(c(u,v) \ge 0\) (see Nelsen, 2006, p. 10; 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 R matrix of either \(c(u,v)\) or \(c^\star(u,v)\) can be requested on return. For either matrix, the colnames() and rownames() (the R functions) 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 examples of Joe's advocation for the Hazen plotting positions are available (Joe, 2014, pp. 9, 17, 245, 247--248).

Usage

densityCOPplot(cop=NULL, para=NULL, deluv=0.002,
               getmatrix=c("none", "cdenzz", "cden"), n=0,
               ploton=TRUE, snv=TRUE, origins=TRUE,
               contour.col=1, contour.lwd=1.5, ...)

Value

This is a high-level function used for its side effects; an R

matrix can be triggered, however, as a returned value.

Arguments

cop

A copula function;

para

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

deluv

The change in the sequences \(\{u, v\} \mapsto \delta, \ldots, 1-\delta; \delta = \Delta(uv)\) probabilities;

getmatrix

A trigger on whether the density matrix is to be returned. The option 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)\));

ploton

A logical to toggle on the plot;

snv

A logical to toggle standard normal variates for the axes;

origins

A logical to plot the origin lines, if and only if snv is true;

contour.col

The color of the contour lines, which corresponds to the col argument of the contour function in R;

contour.lwd

The width of the contour lines, which corresponds to the lwd argument of the contour function in R;

n

An optional sample size for which simulation of this many values from the copula will be made by simCOP and drawn; and

...

Additional arguments to pass to the copula function and to the contour function in R (e.g. to turn off labeling of contours add drawlabels=FALSE).

Author

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

simCOP, densityCOP