Estimate a copula's dependence parameter(s) – and, when a marginal names a family without
parameters, that marginal's own parameters – from a paired sample. Mirrors the C#
BivariateCopulaEstimation methods of the Numerics library.
Usage
copula_fit(
family,
x,
y,
method = c("mpl", "ifm", "mle", "tau"),
margin_x = NULL,
margin_y = NULL
)Arguments
- family
one of
copula_names().- x, y
numeric vectors of raw paired observations, the same length.
- method
"mpl"(maximum pseudo-likelihood, the default),"ifm"(inference from margins),"mle"(full maximum likelihood), or"tau"(Kendall's tau inversion; Clayton, Gumbel, and AliMikhailHaq only).- margin_x, margin_y
optional marginals; see Details.
Details
x and y are the raw paired observations for every method. method = "mpl" maximizes the
pseudo-likelihood, which is defined on the plotting positions rank / (n + 1) rather than on
the data scale; that transform happens inside the shared C++ core, so R and Python fit the
same numbers from the same input.
margin_x and margin_y accept EITHER a family-name string or a corehydro_dist, and the
two are handled differently:
a name (e.g.
margin_x = "Normal") is fitted by maximum likelihood tox(ory) before the copula is estimated. This is what Inference From Margins (method = "ifm") requires, and it is accepted for"ifm"and"mle"only:"mpl"and"tau"ignore the marginals entirely, so a name there would be reported back unfitted.a
corehydro_dist(e.g.margin_x = distribution("Normal", c(0, 1))) is accepted for all four methods."mpl"and"tau"attach it untouched (socopula_random()can draw on the data scale),"ifm"takes it as the given margin, and"mle"re-estimates it jointly with theta.
method = "tau" inverts Kendall's tau into theta directly and is only implemented upstream
for Clayton, Gumbel, and AliMikhailHaq (SetThetaFromTau); it errors for every other family.