Learn R Programming

copBasic (version 2.2.8)

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

Description

Compute the numerical partial derivative of a copula, which is a conditional distribution function, 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] = \mathbf{C}_{1 \mid 2}(u \mid 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 under derCOP.

Copula derivatives (\(\delta \mathbf{C}/\delta v\) or say \(\delta \mathbf{C}/\delta u\) derCOP) are non-decreasing functions meaning that if \(u_1 \le u_2\), then \(\mathbf{C}(u_2, v) - \mathbf{C}(u_1,v)\) is a non-decreasing function in \(v\), thus $$\frac{\delta\bigl(\mathbf{C}(u_2, v) - \mathbf{C}(u_1,v)\bigr)}{\delta v}$$ is non-negative, which means $$\frac{\delta\mathbf{C}(u_2, v)}{\delta v} \ge \frac{\delta\mathbf{C}(u_1, v)}{\delta v}\mbox{\ for\ } u_2 \ge u_1\mbox{.}$$

Usage

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

Arguments

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,"\n"))
# 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,"\n")) # For this example, all are correct (see derCOP examples)

Run the code above in your browser using DataLab