Learn R Programming

copBasic (version 1.7.1)

derCOP2: Numerical Derivative of a Copula for U with respect to V

Description

Compute the numerical partial derivative of a copula according to Nelsen (2006, pp. 13, 40--41) with respect to $v$:

$$0 \le \frac{\delta}{\delta v} \mathbf{C}(u,v) \le 1\mbox{,}$$

or

$$\mathrm{Pr}[U \le u\mid V=v] = \lim_{\Delta v \rightarrow 0}\frac{\mathbf{C}(u, v+\Delta v) - \mathbf{C}(u,v)}{\Delta v}\mbox{,}$$

which is to read as the probability that $U \le u$ given that $V = v$ and corresponds to the derdir="left" mode of the function. For derdir="right", the following results $$\mathrm{Pr}[U \le u\mid V=v] = \lim_{\Delta v \rightarrow 0}\frac{\mathbf{C}(u,v) - \mathbf{C}(u, v-\Delta v)}{\Delta v}\mbox{,}$$ and for derdir="center" (the usual method of computing a derivative), the following results $$\mathrm{Pr}[U \le u\mid V=v] = \lim_{\Delta v \rightarrow 0}\frac{\mathbf{C}(u,v+\Delta v) - \mathbf{C}(u, v-\Delta v)}{2 \Delta v}\mbox{.}$$ The with respect to $U$ versions are seen under derCOP.

Usage

derCOP2(cop=NULL, u, v, delv=.Machine$double.eps^0.50,
        derdir=c("left", "right", "center"), ...)

Arguments

cop
A copula function;
u
Nonexceedance probability $u$ in the $X$ direction. If the length of u is unity, then the length of v can be arbitrarily long. If the length of u is not unity, then the length of v should be the same and
v
Nonexceedance probability $v$ in the $Y$ direction (see previous comment on u);
delv
The $\Delta v$ interval for the derivative;
derdir
The direction of the derivative as described above. Default is left but internally any setting can be temporarily suspended to avoid improper computations (see source code); and
...
Additional arguments to pass such as the parameters often described in para arguments of other copula functions. (The lack of para=NULL for derCOP and derCOP2 was eithe

Value

  • Value(s) for the partial derivative are returned.

References

Nelsen, R.B., 2006, An introduction to copulas: New York, Springer, 269 p.

See Also

derCOPinv2, derCOP

Examples

Run this code
derCOP2(cop=W,0.4,0.6); derCOP2(cop=P,0.4,0.6); derCOP2(cop=M,0.4,0.6)

lft <- derCOP2(cop=P,0.4,0.6, derdir="left")
rgt <- derCOP2(cop=P,0.4,0.6, derdir="right")
cnt <- derCOP2(cop=P,0.4,0.6, derdir="center")
cat(c(lft,rgt,cnt,""))
# stopifnot(all.equal(lft,rgt), all.equal(lft,cnt))

# Let us contrive a singularity though this NOT A COPULA in the function "afunc".
"afunc" <- function(u,v, ...) return(ifelse(u <= 0.5, sqrt(u^2+v^2), P(u,v,...)))
lft <- derCOP2(cop=afunc,0.67, 0.5, derdir="left")
rgt <- derCOP2(cop=afunc,0.67, 0.5, derdir="right")
cnt <- derCOP2(cop=afunc,0.67, 0.5, derdir="center")
cat(c(lft,rgt,cnt,"")) # For this example, all are correct (see derCOP examples)

Run the code above in your browser using DataLab