Learn R Programming

copBasic (version 2.0.1)

simCOPmicro: Simulate V from U through a Copula by Numerical Derivative Method

Description

Perform bivariate simulation of random but coupled variables $V$ from $U$ through a copula (Nelsen, 2006, p. 32) by inversion of the numerical derivatives of the copula (derCOPinv, derCOPinv2). The method is more broadly known as conditional simulation method. An elaborate implementation is available in simCOP, which unlike simCOPmicro, has provisions (default) for graphical support. The simCOPmicro function is intended to be a minimalist version for copula simulation, and such a version is useful for pedagogic purposes including conditional distributions, conditional quantile functions, and copula reflection (see Note and COP). An extended educational discussion of simulation using the conditional method is available in the Note section of derCOPinv.

Some definitions are needed. The copula of $(1-U, 1-V)$ is the survival copula (surCOP) and is defined as $$\hat{\mathbf{C}}(u,v) = u + v - 1 + \mathbf{C}(1-u,1-v)\mbox{,}$$ whereas, following the notation of Joe (2014, pp. 271--272), the copula of $(1-U, V)$ is defined as $$\acute{\mathbf{C}}(u,v) = v - \mathbf{C}(1-u,v)\mbox{, and}$$ the copula of $(U, 1-V)$ is defined as $$\grave{\mathbf{C}}(u,v) = u - \mathbf{C}(u,1-v)\mbox{.}$$

Careful consideration of the nomenclature is necessary as confusion with the occurrences of $1-u$ and $1-v$ easily conflate meaning. The nomenclature for the survival copula is more elaborately shown under surCOP. The difficulty is that the bivariate arguments to the survival copula are exceedance probabilities.

For simulation, again following the nomenclature of Joe (2014, p. 272), the conditional distribution functions (numerical derivatives; derCOP $\equiv$ $\mathbf{C}_{2|1}(v|u)$ and derCOP2 $\equiv$ $\mathbf{C}_{1|2}(u|v)$) can be written in terms of $\mathbf{C}(u|v) = \mathbf{C}_{2|1}(v|u)$ as $$\hat\mathbf{C}_{2|1}(v|u) = 1 - \mathbf{C}_{2|1}(1-v|1-u)\mbox{,}$$ $$\acute\mathbf{C}_{2|1}(v|u) = \mathbf{C}_{2|1}( v|1-u)\mbox{, and}$$ $$\grave\mathbf{C}_{2|1}(v|u) = 1 - \mathbf{C}_{2|1}(1-v| u)\mbox{,}$$ where the respective "surv", "acute", and "grave" are inverses (conditional quantile functions; inverses of numerical derivatives; derCOPinv $\equiv$ $\mathbf{C}^{(-1)}_{2|1}(v|u)$ and derCOPinv2 $\equiv$ $\mathbf{C}^{(-1)}_{1|2}(u|v)$) are $$\hat\mathbf{C}^{(-1)}_{2|1}(t|u) = 1 - \mathbf{C}^{(-1)}_{2|1}(1-t|1-u)\:\rightarrow\mbox{\ \code{"sur"},}$$ $$\acute\mathbf{C}^{(-1)}_{2|1}(t|u) = \mathbf{C}^{(-1)}_{2|1}( t|1-u)\:\rightarrow\mbox{\ \code{"acute"}, and}$$ $$\grave\mathbf{C}^{(-1)}_{2|1}(t|u) = 1 - \mathbf{C}^{(-1)}_{2|1}(1-t| u)\:\rightarrow\mbox{\ \code{"grave"},}$$ where $t$ is a uniformly distributed variable.

To clarify the seemingly clunky nomenclature---Joe (2014) does not provide names for $\acute\mathbf{C}(u,v)$ or $\grave\mathbf{C}(u,v)$---the following guidance is informative: $\mbox{}\quad\mbox{}$(1) "surv" or $\hat\mathbf{C}(u,v)$ is a reflection of $U$ and $V$ on the horizontal and vertical axes, respectively $\mbox{}\quad\mbox{}$(2) "acute" or $\acute\mathbf{C}(u,v)$ is a reflection of $U$ on the horizontal axis, and $\mbox{}\quad\mbox{}$(3) "grave" or $\grave\mathbf{C}(u,v)$ is a reflection of $V$ on the verical axis. The names "acute" and "grave" match those used in the Rd-format math typesetting instructions.

Usage

simCOPmicro(u, cop=NULL, para=NULL,
               reflect=c("cop", "surv", "acute", "grave"), ...)
simCOPv(u, cop=NULL, para=NULL,
               reflect=c("cop", "surv", "acute", "grave"), ...)

Arguments

u
Nonexceedance probability $u$ in the $X$ direction. The runif() function in Rcan be used to drive conditional simulation using the simCOPmicro function (see Examples);
cop
A copula function;
para
Vector of parameters, if needed, to pass to the copula;
reflect
The reflection of the copula (see above) and the default "cop" is the usual copula definition; and
...
Additional arguments to pass should they be needed.

Value

  • Simulated value(s) of nonexceedance probability $v$ are returned based on the nonexceedance probabilities $u$ in argument u.

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

Examples

Run this code
simCOPmicro(runif(1), cop=W)   # Frechet lower bound copula
simCOPmicro(runif(1), cop=P)   # Independence copula
simCOPmicro(runif(1), cop=M)   # Frechet upper bound copula
simCOPmicro(runif(1), cop=PSP) # The PSP copula

# Now let us get more complicated and mix two Plackett copulas together using the
# composite2COP as a "compositor." The parameter argument becomes more complex, but is
# passed as shown into composite2COP.
para <- list(cop1=PLACKETTcop,cop2=PLACKETTcop, alpha=0.3,beta=0.5, para1=0.1,para2=50)
simCOPmicro(runif(5), cop=composite2COP, para=para)

# Now let us implement "our" own version of features of simCOP() but using
# the micro version to manually create just the simulation vector of V.
U <- runif(1500)
UV <- data.frame(U, simCOPmicro(U, cop=N4212cop, para=4))
plot(UV, xlab="PROBABILITY IN U", ylab="PROBABILITY IN V", pch=3, col=2)

Run the code above in your browser using DataLab