simCOPmicro {copBasic} | R Documentation |
Simulate V from U through a Copula by Numerical Derivative Method
Description
Perform bivariate simulation of random but coupled variables from
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 is the survival copula (
surCOP
) and is defined as
whereas, following the notation of Joe (2014, pp. 271–272), the copula of is defined as
the copula of is defined as
Careful consideration of the nomenclature is necessary as confusion with the occurrences of and
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
and
derCOP2
) can be written in terms of
as
where the respective "surv"
, "acute"
, and "grave"
are inverses (conditional quantile functions; inverses of numerical derivatives; derCOPinv
and
derCOPinv2
) are
where is a uniformly distributed variable.
To clarify the seemingly clunky nomenclature—Joe (2014) does not provide “names” for or
—the following guidance is informative:
(1)
"surv"
or is a reflection of
and
on the horizontal and vertical axes, respectively
(2)
"acute"
or is a reflection of
on the horizontal axis, and
(3)
"grave"
or is a reflection of
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 |
cop |
A copula function; |
para |
Vector of parameters, if needed, to pass to the copula; |
seed |
The integer seed to pass immediately to |
reflect |
The reflection of the copula (see above) and the default |
... |
Additional arguments to pass should they be needed. |
Value
Simulated value(s) of nonexceedance probability are returned based on the nonexceedance probabilities
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 (;
GHcop
), which has substantial upper tail dependency but no lower tail dependency for 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 and
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 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
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)