vinecopulas.bivariate

Created on Thu Feb 22 16:39:03 2024

Attributes

copulas

Functions

fit(cop, u)

Fits a specific copula to data.

bestcop(cops, u)

Fits the best copula to data based on a selected list of copulas to fit to using the AIC.

random(cop, par, n)

Generates random numbers from a chosen copula with specific parameters.

randomconditional(cop, ui, par, n[, un])

Generates conditional random numbers from a chosen copula with specific parameters.

CDF(cop, u, par)

Computes the cumulative distribution function.

PDF(cop, u, par)

Computes the probability density function.

hfunc(cop, u1, u2, par[, un])

Computes the h-function (conditional CDF) of a copula with respect to variable u1 or u2.

hfuncinverse(cop, ui, y, par[, un])

Computes the inverse h-function (inverse conditional CDF) of a copula with respect to variable u1 or u2.

neg_likelihood(par, cop, u)

Computes the negative likelihood function.

Module Contents

vinecopulas.bivariate.copulas[source]
vinecopulas.bivariate.fit(cop, u)[source]

Fits a specific copula to data.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1).

u : A 2-d numpy array containing the samples for which the copulae will be fit. Column 1 contains variable u1, and column 2 contains variable u2.

Returns:

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

vinecopulas.bivariate.bestcop(cops, u)[source]

Fits the best copula to data based on a selected list of copulas to fit to using the AIC.

Arguments:

cops : A list of integers referring to the copulae of interest for which the fit has to be evaluated. eg. a list of [1, 10] refers to the Gaussian and Frank copula (see Table 1).

u : A 2-d numpy array containing the samples for which the copulae will be fit and evaluated. Column 1 contains variable u1, and column 2 contains variable u2.

Returns:

cop : An integer referring to the copula with the best fit. eg. a 1 refers to the gaussian copula (see Table 1).

par : The correlation parameters of the copula with the best fit, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

aic : The Akaike information criterion of the copula with the best fit.

vinecopulas.bivariate.random(cop, par, n)[source]

Generates random numbers from a chosen copula with specific parameters.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1).

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

n : Number of random samples to return, specified a positive integer.

Returns:

u : A 2-d numpy array containing random samples with n amount of rows. Column 1 contains variable u1, and column 2 contains variable u2.

vinecopulas.bivariate.randomconditional(cop, ui, par, n, un=1)[source]

Generates conditional random numbers from a chosen copula with specific parameters.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1)

ui : A 1-d numpy array containing the samples of variable u1, if evaluated with respect to u1, or u2 if evaluated with respect to u2 on which conditional samples should be computed

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1)

n: number of samples to draw

un : indicated with respect to which variable the conditional samples have to be drawn. if un = 1, conditional samples of u2 will be drawn based on u1, if un = 2, conditional samples of u1 will be drawn based on u2.

Returns:

uii : A 1-d numpy array containing the inverse h-function of the copula evaluated with respect to u1 or u2.

vinecopulas.bivariate.CDF(cop, u, par)[source]

Computes the cumulative distribution function.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1).

u : A 2-d numpy array containing the samples for which the CDF will be calculated. Column 1 contains variable u1, and column 2 contains variable u2.

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

Returns:

p : A 1-d numpy array containing the cumulative distribution function of the copula evaluated at u1 and u2.

vinecopulas.bivariate.PDF(cop, u, par)[source]

Computes the probability density function.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1).

u : A 2-d numpy array containing the samples for which the PDF will be calculated. Column 1 contains variable u1, and column 2 contains variable u2.

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

Returns:

y : A 1-d numpy array containing the probability density function of the copula evaluated at u1 and u2.

vinecopulas.bivariate.hfunc(cop, u1, u2, par, un=1)[source]

Computes the h-function (conditional CDF) of a copula with respect to variable u1 or u2.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1)

u1 : A 1-d numpy array containing the samples of variable u1

u2 : A 1-d numpy array containing the samples of variable u2

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

un : indicated with respect to which variable the h-function has to be calculated. if un = 1, the h-function is calculated with respect to u1 (c(u2|u1)), if un = 2, the h-function is calculated with respect to u2 (c(u1|u2)).

Returns:

y : A 1-d numpy array containing the h-function of the copula evaluated with respect to u1 or u2.

vinecopulas.bivariate.hfuncinverse(cop, ui, y, par, un=1)[source]

Computes the inverse h-function (inverse conditional CDF) of a copula with respect to variable u1 or u2.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1).

ui : A 1-d numpy array containing the samples of variable u1, if evaluated with respect to u1, or u2 if evaluated with respect to u2.

y : A 1-d numpy array containing the h-function of the copula evaluated with respect to u1 or u2.

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

un : indicated with respect to which variable the h-function has to be calculated. if un = 1, the h-function is calculated with respect to u1 (c(u2|u1)), if un = 2, the h-function is calculated with respect to u2 (c(u1|u2)).

Returns:

uii : A 1-d numpy array containing the inverse h-function of the copula evaluated with respect to u1 or u2.

vinecopulas.bivariate.neg_likelihood(par, cop, u)[source]

Computes the negative likelihood function.

Arguments:

cop : An integer referring to the copula of choice. eg. a 1 refers to the gaussian copula (see Table 1).

u : A 2-d numpy array containing the samples for which the CDF will be calculated. Column 1 contains variable u1, and column 2 contains variable u2.

par : The correlation parameters of the copula, provided as a scalar value for copulas with one parameter and as a list for copulas with more parameters (see Table 1).

Returns:

l : The negative likelihood as a scalar value.