BicopBase

class BicopBase(*args, **kwargs)

Canonical partial implementation of BicopLike.

Subclasses implement pdf / hfunc1 / hfunc2 and inherit hinv1 / hinv2 (bisection of the h-functions), simulate, loglik, plot and __repr__. cdf raises unless overridden. To enable simulate, override _simulate_uniform with the array namespace’s RNG.

Methods

cdf(u[, x])

Raise; the vine CDF is Monte-Carlo, so a per-pair cdf is 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 at u.

plot([plot_type, margin_type, xylim, grid_size])

Plot the pair-copula density (contour or 3-D surface).

simulate(n, *[, x, qrng, seeds])

Draw n samples via the pair's inverse Rosenblatt transform.

See also

pyvinecopulib.core.BicopLike

The contract this implements.

pyvinecopulib.torch.TorchBicop

A concrete (grid / TLL) subclass.

Examples

A minimal independence pair on NumPy — implement only the three primitives and inherit hinv1 / hinv2 / simulate / loglik / plot / __repr__ from BicopBase:

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

__init__

cdf

Raise; the vine CDF is Monte-Carlo, so a per-pair cdf is optional.

flip

Raise; override to return the pair with its arguments swapped.

hfunc1

First h-function P(U2 <= u2 | U1 = u1).

hfunc2

Second h-function P(U1 <= u1 | U2 = u2).

hinv1

Numerically invert hfunc1() in its second argument.

hinv2

Numerically invert hfunc2() in its first argument.

loglik

Total log-likelihood sum(log c(u)) of the pair at u.

pdf

Pair-copula density c(u) at each observation.

plot

Plot the pair-copula density (contour or 3-D surface).

simulate

Draw n samples via the pair's inverse Rosenblatt transform.