Student

The implementation of the Student (T) copula is such that all the univariate marginal distributions are student and the multivariate joint distribution is a multivariate-student distribution.

Note that the degrees-of-freedom parameter is shared by all univariate margins as well as the joint multivariate distribution

class copulae.elliptical.StudentCopula(*args, **kwds)[source]

The Student (T) Copula. It is elliptical and symmetric which gives it nice analytical properties. The Student copula is determined by its correlation matrix and the degrees of freedom. Student copulas have fatter tails as compared to Gaussian copulas.

A Student copula is fined as

\[C_{\Sigma, \nu} (u_1, \dots, u_d) = \mathbf{t}_{\Sigma, \nu} (t_\nu^{-1} (u_1), \dots, t_\nu^{-1} (u_d))\]

where \(\Sigma\) and \(\nu\) are the covariance matrix and degrees of freedom which describes the Student copula and \(t_\nu^{-1}\) is the quantile (inverse cdf) function

property bounds

Gets the bounds for the parameters

Returns

Lower and upper bound of the copula’s parameters

Return type

(scalar or array_like, scalar or array_like)

property dim

Number of dimensions in copula

fit(data, x0=None, method='ml', optim_options=None, ties='average', verbose=1, to_pobs=True, scale=1.0, fix_df=False)[source]

Fit the copula with specified data

Parameters
  • data (ndarray) – Array of data used to fit copula. Usually, data should be the pseudo observations

  • x0 (ndarray) – Initial starting point. If value is None, best starting point will be estimated

  • method ({ 'ml', 'irho', 'itau' }, optional) – Method of fitting. Supported methods are: ‘ml’ - Maximum Likelihood, ‘irho’ - Inverse Spearman Rho, ‘itau’ - Inverse Kendall Tau

  • optim_options (dict, optional) – Keyword arguments to pass into scipy.optimize.minimize()

  • ties ({ 'average', 'min', 'max', 'dense', 'ordinal' }, optional) – Specifies how ranks should be computed if there are ties in any of the coordinate samples. This is effective only if the data has not been converted to its pseudo observations form

  • verbose (int, optional) – Log level for the estimator. The higher the number, the more verbose it is. 0 prints nothing.

  • to_pobs (bool) – If True, casts the input data along the column axis to uniform marginals (i.e. convert variables to values between [0, 1]). Set this to False if the input data are already uniform marginals.

  • scale (float) – Amount to scale the objective function value of the numerical optimizer. This is helpful in achieving higher accuracy as it increases the sensitivity of the optimizer. The downside is that the optimizer could likely run longer as a result. Defaults to 1.

  • fix_df (bool, optional) – If True, the degree of freedom specified by the user (param) is fixed and will not change. Otherwise, the degree of freedom is subject to changes during the fitting phase.

See also

scipy.optimize.minimize

the scipy minimize function use for optimization

irho(rho)[source]

irho is not implemented for t copula

log_lik(data, *, to_pobs=True, ties='average')

Returns the log likelihood (LL) of the copula given the data.

The greater the LL (closer to \(\infty\)) the better.

Parameters
  • data (ndarray) – Data set used to calculate the log likelihood

  • to_pobs – If True, converts the data input to pseudo observations.

  • ties – Specifies how ranks should be computed if there are ties in any of the coordinate samples. This is effective only if to_pobs is True.

Returns

Log Likelihood

Return type

float

property params

The parameters of the Student copula. A tuple where the first value is the degrees of freedom and the subsequent values are the correlation matrix parameters

Returns

A dataclass with 2 properties

df: float

Degrees of freedom

corr: ndarray

Correlation parameters

Return type

StudentParams

static pobs(data, ties='average')

Compute the pseudo-observations for the given data matrix

Parameters
  • data ({ array_like, DataFrame }) – Random variates to be converted to pseudo-observations

  • ties ({ 'average', 'min', 'max', 'dense', 'ordinal' }, optional) – Specifies how ranks should be computed if there are ties in any of the coordinate samples

Returns

matrix or vector of the same dimension as data containing the pseudo observations

Return type

ndarray

See also

pseudo_obs()

The pseudo-observations function

property sigma

The covariance matrix for the elliptical copula

Returns

numpy array Covariance matrix for elliptical copula