Learn R Programming

copBasic (version 1.7.1)

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

Description

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

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

or

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

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

Usage

derCOP(cop=NULL, u, v, delu=.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);
delu
The $\Delta u$ 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 eith

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

derCOPinv, derCOP2

Examples

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

lft <- derCOP(cop=PSP,0.4,0.6, derdir="left")
rgt <- derCOP(cop=PSP,0.4,0.6, derdir="right")
cnt <- derCOP(cop=PSP,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 through 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 <- derCOP(cop=afunc, 0.5, 0.67, derdir="left")
rgt <- derCOP(cop=afunc, 0.5, 0.67, derdir="right")
cnt <- derCOP(cop=afunc, 0.5, 0.67, derdir="center")
cat(c(lft,rgt,cnt,"")) # The "right" version is correct.

Run the code above in your browser using DataLab