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

simCOPmicroR Documentation

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, seed=NULL,
               reflect=c("cop", "surv", "acute", "grave",
                           "1",    "2",     "3",     "4"), ...)
simCOPv(u, cop=NULL, para=NULL,
               reflect=c("cop", "surv", "acute", "grave",
                           "1",    "2",     "3",     "4"), ...)

Arguments

u

Nonexceedance probability u in the X direction. The runif() function in R can 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;

seed

The integer seed to pass immediately to set.seed() and setting it for the simCOPv version will dispatch through the triple dots down to simCOPmicro;

reflect

The reflection of the copula (see above) and the default "cop" or "1" is the usual copula definition. The numbered values correspond, respectively, to the named values; 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.

Note

The advanced features of simCOPmicro permit simulation of the three permutations of variable reflection. The first code simply produce four different “copulas” based on the Gumbel–Hougaard copula (\mathbf{GH}(u,v; \Theta); GHcop), which has substantial upper tail dependency but no lower tail dependency for \Theta = 2.512 as quantified by the taildepCOP function call.

  U <- runif(1500); G <- 2.512; u <- 0.1; up <- 1-u; v <- 0.2; vp <- 1-v
  UV   <- data.frame(U, simCOPmicro(U, cop=GHcop, para=G                 ))
  sUsV <- data.frame(U, simCOPmicro(U, cop=GHcop, para=G, reflect="surv" ))
  sUV  <- data.frame(U, simCOPmicro(U, cop=GHcop, para=G, reflect="acute"))
  UsV  <- data.frame(U, simCOPmicro(U, cop=GHcop, para=G, reflect="grave"))
  taildepCOP(cop=GHcop, para=G) # lambdaL = 2e-05; lambdaU = 0.68224

The following code example will verify that the simulations produce values of U and V that are consistent with the empirical copula (EMPIRcop) results as well as consistent with the variable reflections provided through the COP interface. Notice the combinations of nonexceedance and exceedance probabilities blended so that the two returned values for the four different copulas are numerically congruent.

  c(EMPIRcop(u, v,  para=UV  ), COP(u, v,  cop=GHcop, para=G, reflect="cop"  ))
  c(EMPIRcop(up,vp, para=sUsV), COP(up,vp, cop=GHcop, para=G, reflect="surv" ))
  c(EMPIRcop(up,v,  para=sUV ), COP(up,v,  cop=GHcop, para=G, reflect="acute"))
  c(EMPIRcop(u, vp, para=UsV ), COP(u, vp, cop=GHcop, para=G, reflect="grave"))

The user can verify the reflections graphically using code such as this

  xlab <- "PROBABILITY IN U"; ylab <- "PROBABILITY IN V"
  layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE));
  plot(UV,   xlab=xlab, ylab=ylab, pch=3, lwd=0.5, col=1)
    mtext("no reflection")
  plot(sUV,  xlab=xlab, ylab=ylab, pch=3, lwd=0.5, col=3)
    mtext("horizontal reflection")
  plot(UsV,  xlab=xlab, ylab=ylab, pch=3, lwd=0.5, col=4)
    mtext("vertical reflection")
  plot(sUsV, xlab=xlab, ylab=ylab, pch=3, lwd=0.5, col=2)
    mtext("double reflection")

in which inspection of tails exhibiting the dependency is readily seen on the four plots: upper right tail dependency (no reflection), upper left tail dependency (horizontal reflection), lower right tail dependency (vertical reflection), and lower left tail dependency (double reflection). It is important to stress that these descriptions and graphical depictions of single tail dependency are specific to the \mathbf{GH}(u,v; \Theta) copula chosen for the demonstration.

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

simCOP

Examples

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

## Not run: 
# 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) #
## End(Not run)

## Not run: 
# 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) #
## End(Not run)

copBasic documentation built on Oct. 17, 2023, 5:08 p.m.