Adding a pair copula
A bivariate Copulas.jl copula can be used inside a vine when its density and conditional operations are reliable.
Support for evaluation, specialized kernels, and automatic fitting and selection are separate levels of integration.
Basic evaluation contract
For generic vine evaluation, the underlying bivariate copula should provide reliable behavior for operations equivalent to
logpdf(C, [u, v])
D1 = condition(C, 2, v)
cdf(D1, u)
quantile(D1, q)
D2 = condition(C, 1, u)
cdf(D2, v)
quantile(D2, q)VineCopulas.jl uses these operations to provide generic pair-copula density and conditional fallbacks.
Therefore a new Copulas.jl family does not necessarily require duplicated hfunc1, hfunc2, hinv1, or hinv2 implementations.
Optional specialized kernels
A family may specialize any of
_pair_logpdf(C, u, v, buf)
hfunc1(C, u, v)
hfunc2(C, u, v)
hinv1(C, q, v)
hinv2(C, q, u)when doing so materially improves performance, allocation behavior, numerical stability, tail behavior, or handling of singular distributions.
For families with expensive coordinate transforms, the internal fused hooks can additionally be specialized:
_pair_hfuncs(C, u, v)
_pair_step(C, u, v, buf)
_pair_logpdf_h1(C, u, v, buf)
_pair_logpdf_h2(C, u, v, buf)Generic implementations already compose the standalone primitives, so these methods are performance hooks rather than a new compatibility requirement. A specialization should reuse the same transformed coordinates and must return values numerically consistent with the standalone density/h-function methods.
Specialized methods must remain consistent with the generic conditional definitions
and
For smooth families, the expected inverse round trips are
and
Singular families should instead satisfy the appropriate generalized-inverse conditions.
Fitting and selection support
Evaluation support is distinct from automatic fitting and family selection.
Before adding a family to DEFAULT_PAIR_FAMILIES, also provide:
parameter estimation support;
valid fitting and selection parameter domains;
rotation support where applicable;
selection metadata;
pair-level correctness tests;
fitting and family-selection tests.
A family may therefore be fully usable in a manually specified vine without being a candidate for automatic family selection.
Workflow
Implement and validate the bivariate copula in
Copulas.jl.Verify its density and
conditioninterface.Test the generic
VineCopulas.jlpair-copula fallback.Add specialized kernels only when justified by correctness, stability, or performance.
Add pair-level conditional and inverse-conditional tests.
Add at least one small vine-level integration test.
Add fitting and selection support separately if the family should become an automatic candidate.
Update the Bestiary and fitting documentation as appropriate.
Source location
| Family type | Location |
|---|---|
| Generic pair primitives | src/PairCopulas/Generic.jl |
| Elliptical | src/PairCopulas/Ellipticals/ |
| Archimedean and BB | src/PairCopulas/Archimedeans/ |
| Extreme-value | src/PairCopulas/ExtremeValue/ |
| Miscellaneous | src/PairCopulas/Miscellaneous/ |