| dcopula | R Documentation |
Computes the joint density (or log-density) of a bivariate distribution constructed from two arbitrary margins combined with a specified copula.
dcopula(d1, d2, p1, p2, copula = cgaussian(0), log = FALSE)
d1, d2 |
Marginal density values. If |
p1, p2 |
Marginal CDF values. Need not be supplied on log scale. |
copula |
A function of two arguments ( |
log |
Logical; if |
The joint density is
f(x,y) = c(F_1(x), F_2(y)) \, f_1(x) f_2(y),
where F_i are the marginal CDFs, f_i are the marginal densities,
and c is the copula density.
The marginal densities d1, d2 and CDFs p1, p2
must be differentiable for automatic differentiation (AD) to work.
Available copula constructors are:
cgaussian (Gaussian copula)
cclayton (Clayton copula)
cgumbel (Gumbel copula)
cfrank (Frank copula)
Joint density (or log-density) under the bivariate copula.
ddcopula(), dmvcopula()
# Normal + Exponential margins with Gaussian copula
x <- c(0.5, 1); y <- c(1, 2)
d1 <- dnorm(x, 1, log = TRUE); d2 <- dexp(y, 2, log = TRUE)
p1 <- pnorm(x, 1); p2 <- pexp(y, 2)
dcopula(d1, d2, p1, p2, copula = cgaussian(0.5), log = TRUE)
# Normal + Beta margins with Clayton copula
x <- c(0.5, 1); y <- c(0.2, 0.8)
d1 <- dnorm(x, 1, log = TRUE); d2 <- dbeta(y, 2, 1, log = TRUE)
p1 <- pnorm(x, 1); p2 <- pbeta(y, 2, 1)
dcopula(d1, d2, p1, p2, copula = cclayton(2), log = TRUE)
# Normal + Beta margins with Gumbel copula
x <- c(0.5, 1); y <- c(0.2, 0.4)
d1 <- dnorm(x, 1, log = TRUE); d2 <- dbeta(y, 2, 1, log = TRUE)
p1 <- pnorm(x, 1); p2 <- pbeta(y, 2, 1)
dcopula(d1, d2, p1, p2, copula = cgumbel(1.5), log = TRUE)
# Normal + Exponential margins with Frank copula
x <- c(0.5, 1); y <- c(1, 2)
d1 <- dnorm(x, 1, log = TRUE); d2 <- dexp(y, 2, log = TRUE)
p1 <- pnorm(x, 1); p2 <- pexp(y, 2)
dcopula(d1, d2, p1, p2, copula = cfrank(2), log = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.