BicopBase
- class BicopBase(*args, **kwargs)
Canonical partial implementation of
BicopLike.Subclasses implement
pdf/hfunc1/hfunc2and inherithinv1/hinv2(bisection of the h-functions),simulate,loglik,plotand__repr__.cdfraises unless overridden. To enablesimulate, override_simulate_uniformwith the array namespace’s RNG.Methods
cdf(u[, x])Raise; the vine CDF is Monte-Carlo, so a per-pair
cdfis optional.flip()Raise; override to return the pair with its arguments swapped.
hinv1(u[, x])Numerically invert
hfunc1()in its second argument.hinv2(u[, x])Numerically invert
hfunc2()in its first argument.loglik(u[, x])Total log-likelihood
sum(log c(u))of the pair atu.plot([plot_type, margin_type, xylim, grid_size])Plot the pair-copula density (contour or 3-D surface).
simulate(n, *[, x, qrng, seeds])Draw
nsamples via the pair's inverse Rosenblatt transform.See also
pyvinecopulib.core.BicopLikeThe contract this implements.
pyvinecopulib.torch.TorchBicopA concrete (grid / TLL) subclass.
Examples
A minimal independence pair on NumPy — implement only the three primitives and inherit
hinv1/hinv2/simulate/loglik/plot/__repr__fromBicopBase:import numpy as np from pyvinecopulib.core import BicopBase class Independence(BicopBase[np.ndarray]): def pdf(self, u, x=None): return np.ones(u.shape[0]) def hfunc1(self, u, x=None): return u[:, 1] def hfunc2(self, u, x=None): return u[:, 0] cop = Independence() cop.hinv1(np.array([[0.3, 0.7]])) # -> array([0.7]) (numerical inverse)
Methods
Raise; the vine CDF is Monte-Carlo, so a per-pair
cdfis optional.Raise; override to return the pair with its arguments swapped.
First h-function
P(U2 <= u2 | U1 = u1).Second h-function
P(U1 <= u1 | U2 = u2).Numerically invert
hfunc1()in its second argument.Numerically invert
hfunc2()in its first argument.Total log-likelihood
sum(log c(u))of the pair atu.Pair-copula density
c(u)at each observation.Plot the pair-copula density (contour or 3-D surface).
Draw
nsamples via the pair's inverse Rosenblatt transform.