Learn R Programming

copula (version 0.999-14)

cCopula: Conditional Copula Function

Description

Compute the conditional distribution aka conditional copula function, $C(u[d] | u[1],..., u[d-1])$ of $u[d]$ given $u[1],..., u[d-1]$.

Usage

cCopula(u, copula, j.ind=ncol(u), n.MC=0, log=FALSE)
## Deprecated, for Archimedean copulas only: cacopula(u, cop, n.MC=0, log=FALSE)

Arguments

u
$n x d$-matrix; the conditioning is done on the values in the first $d-1$ columns.
copula
any "copula" with specified parameters; currently only Archimedean and elliptical copulas provided.
j.ind
indices $j>=2$ for which $C(u[j]|u[1],...,u[j-1])$ is computed.
cop
"outer_nacopula" with specified parameters (only Archimedean copulas are currently provided).
n.MC
Monte Carlo sample size; for Archimedean copulas only, used if positive.
log
if TRUE the logarithm of the conditional copula function is returned.

Value

numeric vector of length $n$ containing the conditional copula function of $u[d]$ given $u[1],...,u[d-1]$.

Details

cCopula() can be seen as a special case of the Rosenblatt transform which by default computes all conditional distributions. Conseqently, cCopula() simply calls rtrafo().

Note that sampling aka random number generation from the conditional distribution can be achieved by rtrafo(*, inverse=TRUE).

See Also

rtrafo; acopula-families.

Examples

Run this code
tau <- 0.5
(theta <- copGumbel@iTau(tau)) # 2
d <- 2
# two ways to specify a Gumbel copula:
cop  <- onacopulaL("Gumbel", list(theta,1:d))
gCop <- gumbelCopula(theta, dim=d) #

n <- 1000
set.seed(1)
U <- rCopula(n, cop)

U. <- cbind(U[,1], cCopula(U, cop=cop)) # should be ~ U[0,1]^2
plot(U.[,1],U.[,2])

stopifnot(all.equal(cacopula(U, cop),# with deprecation warning
                    cCopula (U, cop)))

## more examples:  -->  ?rtrafo

Run the code above in your browser using DataLab