Copula

This file contains all the classes for copula objects.

class copula.Copula(dim=2, name='indep')

Methods

cdf(x)

Returns the cumulative distribution function (CDF) of the copula.

Parameters:

x : numpy array (of size d)

Values to compute CDF.

concentrationDown(x)

Returns the theoritical lower concentration function.

Parameters:x : float (between 0 and 0.5)
concentrationFunction(x)

Returns the theoritical concentration function.

Parameters:x : float (between 0 and 1)
concentrationUp(x)

Returns the theoritical upper concentration function.

Parameters:x : float (between 0.5 and 1)
correlations(X)

Compute the correlations of the specified data. Only available when dimension of copula is 2.

Parameters:

X : numpy array (of size n * 2)

Values to compute correlations.

Returns:

kendall : float

The Kendall tau.

pearson : float

The Pearson’s R

spearman : float

The Spearman’s R

getDimension()

Returns the dimension of the copula.

kendall()

Returns the Kendall’s tau. Note that you should previously have computed correlations.

pdf(x)

Returns the probability distribution function (PDF) of the copula.

Parameters:

x : numpy array (of size d)

Values to compute PDF.

pearson()

Returns the Pearson’s r. Note that you should previously have computed correlations.

spearman()

Returns the Spearman’s rho. Note that you should previously have computed correlations.

Archimedean Copulas

class copula.ArchimedeanCopula(family='clayton', dim=2)

Methods

cdf(x)

Returns the CDF of the copula.

Parameters:

x : numpy array (of size copula dimension or n * copula dimension)

Quantiles.

Returns:

float

The CDF value on x.

fit(X, method='cmle', verbose=False, theta_bounds=None, **kwargs)

Fit the archimedean copula with specified data.

Parameters:

X : numpy array (of size n * copula dimension)

The data to fit.

method : str

The estimation method to use. Default is ‘cmle’.

verbose : bool

Output various informations during fitting process.

theta_bounds : tuple

Definition set of theta. Use this only with custom family.

**kwargs

Arguments of method. See estimation for more details.

Returns:

float

The estimated parameter of the archimedean copula.

estimationData

Various data from estimation method. Often estimated hyper-parameters.

pdf_param(x, theta)

Returns the PDF of the copula with the specified theta. Use this when you want to compute PDF with another parameter.

Parameters:

x : numpy array (of size n * copula dimension)

Quantiles.

theta : float

The custom parameter.

Returns:

float

The PDF value on x.

Gaussian Copulas

class copula.GaussianCopula(dim=2, sigma=[[1, 0.8], [0.8, 1]])

Methods

fit(X, method='cmle', verbose=True, **kwargs)

Fit the Gaussian copula with specified data.

Parameters:

X : numpy array (of size n * copula dimension)

The data to fit.

method : str

The estimation method to use. Default is ‘cmle’.

verbose : bool

Output various informations during fitting process.

**kwargs

Arguments of method. See estimation for more details.

Returns:

float

The estimated parameters of the Gaussian copula.

setCovariance(sigma)

Set the covariance of the copula.

Parameters:

sigma : numpy array (of size copula dimensions * copula dimension)

The definite positive covariance matrix. Note that you should check yourself if the matrix is definite positive.

Student Copulas

class copula.StudentCopula(dim=2, df=1, sigma=[[1, 0.6], [0.6, 1]])

Methods

setCovariance(sigma)

Set the covariance of the copula.

Parameters:

sigma : numpy array (of size copula dimensions * copula dimension)

The definite positive covariance matrix. Note that you should check yourself if the matrix is definite positive.