MalteKurz / VineCopulaMatlab

A MATLAB toolbox for vine copulas based on C++
http://maltekurz.github.io/VineCopulaMatlab/
MIT License
36 stars 11 forks source link

Problems with Student's t copula #4

Closed cgroll closed 9 years ago

cgroll commented 9 years ago

some functions do not work as expected for the Student's t copula. For example, the cdf does evaluate to 0 (always?):

>> PairCopulaCDF(19, 0.8, 0.9, [0.5; 5.3])

ans =

     0

Also, inverse v- and h-functions do not work for vector inputs:

>> PairCopulaInvVfun(19, [0.8; 0.2], [0.4; 0.5], [0.5; 5.3])
Unexpected Standard exception from MEX file.
What() is:Error in function boost::math::students_t_distribution<d>::students_t_distribution: Degrees of freedom argument
is 0, but must be > 0 !
..

Error in PairCopulaInvVfun (line 88)
    U=PCInvVfun(family,u1,u2,varargin{1});
MalteKurz commented 9 years ago

I think the problem arises because you used a column vector as parameter.

In general the functions for pair-copulas are written in a way that the observations are always two column vectors and the parameters are either a row vector or a matrix.

In your case, i.e., the t-copula, one needs to specify a (1 x 2) vector of parameters or a (n x 2) matrix of parameters. In the first case the same paramter vector is used for all observations. In the second case every observation has its own parameter vector. Parameter matrices are needed for simulating from non-simplified vine copulas or if you want to use the functions for time-varying pair-copulas.

I think it would be a good idea to include some dimension-checks into the pair-copula functions.