Skip to contents

Three log-likelihoods over a paired sample, differing in how the marginals enter: the pseudo log-likelihood works on the data's pseudo-observations (no marginals needed), IFM (inference from margins) transforms the raw data through the attached marginal CDFs then evaluates the copula density, and the full log-likelihood adds the marginal log-densities to that. method = "ifm" and "full" need margin_x/margin_y attached (see copula()).

Usage

copula_log_likelihood(cop, x, y, method = c("pseudo", "ifm", "full"))

Arguments

cop

a corehydro_copula.

x, y

numeric vectors of raw paired observations, the same length.

method

"pseudo" (the default), "ifm", or "full".

Value

a single numeric.

Details

All three methods take x and y as raw paired observations on their own data scale. Upstream's pseudo log-likelihood is defined on values already on (0, 1), so "pseudo" converts the sample to its plotting positions, rank / (n + 1), first; that transform happens inside the shared C++ core (the same one copula_fit()'s "mpl" fit uses), so R and Python return the same number for the same input. "ifm" and "full" transform through the attached marginal CDFs instead.

Examples

cop <- copula("Clayton", theta = 2,
              margin_x = distribution("Normal", c(110, 20)),
              margin_y = distribution("Normal", c(1.4, 0.3)))
x <- c(135.9, 104.1, 108.7, 99.3, 134.7, 91.0, 77.3, 115.4, 109.0, 79.0)
y <- c(1.9, 1.3, 1.4, 1.2, 1.8, 1.1, 0.9, 1.5, 1.4, 1.0)
copula_log_likelihood(cop, x, y, method = "ifm")
#> [1] 9.359129