| Type: | Package | 
| Title: | Markov Regime Switching Copula Models Estimation and Goodness-of-Fit | 
| Version: | 1.1.0 | 
| Maintainer: | Bruno N Remillard <bruno.remillard@hec.ca> | 
| Description: | Estimation procedures and goodness-of-fit test for several Markov regime switching models and mixtures of bivariate copula models. The goodness-of-fit test is based on a Cramer-von Mises statistic and uses Rosenblatt's transform and parametric bootstrap to estimate the p-value. The proposed methodologies are described in Nasri, Remillard and Thioub (2020) <doi:10.1002/cjs.11534>. | 
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] | 
| Encoding: | UTF-8 | 
| Depends: | mvtnorm, foreach, doParallel, copula | 
| RoxygenNote: | 7.3.2 | 
| NeedsCompilation: | no | 
| Packaged: | 2024-10-01 11:44:22 UTC; 49009427 | 
| Author: | Bouchra R. Nasri [aut], Bruno N Remillard [aut, cre, cph], Mamadou Yamar Thioub [aut], Romanic Pieugueu [aut] | 
| Repository: | CRAN | 
| Date/Publication: | 2024-10-02 16:40:09 UTC | 
CopulaFamiliesCDF
Description
COPULACDF Cumulative probability function for a copula with linear correlation parameters RHO
Usage
CopulaFamiliesCDF(family, u, ...)
Arguments
family | 
 copula familly= "gaussian" , "t" , "clayton" , "frank" , "gumbel"  | 
u | 
 is an N-by-P matrix of values in [0,1], representing N points in the P-dimensional unit hypercube  | 
... | 
 additionnal parameter like RHO a P-by-P correlation matrix.  | 
Value
Y = COPULACDF('Gaussian',U,RHO) returns the cumulative probability of the Gaussian copula with linear correlation parameters RHO, evaluated at the points in U. U is an N-by-P matrix of values in [0,1], representing N points in the P-dimensional unit hypercube. RHO is a P-by-P correlation matrix. If U is an N-by-2 matrix, RHO may also be a scalar correlation coefficient.
Y = COPULACDF('t',U,RHO,NU) returns the cumulative probability of the t copula with linear correlation parameters RHO and degrees of freedom parameter NU, evaluated at the points in U. U is an N-by-P matrix of values in [0,1]. RHO is a P-by-P correlation matrix. If U is an N-by-2 matrix, RHO may also be a scalar correlation coefficient.
Y = COPULACDF(FAMILY,U,ALPHA) returns the cumulative probability of the bivariate Archimedean copula determined by FAMILY, with scalar parameter ALPHA, evaluated at the points in U. FAMILY is 'Clayton', 'Frank', ort 'Gumbel'. U is an N-by-2 matrix of values in [0,1].
Examples
 u = seq(0,1,0.1);
    U1=matrix(rep(u,length(u)),nrow=length(u),byrow = TRUE); U2=t(U1)
   F = CopulaFamiliesCDF('clayton',cbind(c(U1), c(U2)),1)
Estimation of bivariate Markov regime switching bivariate copula model
Description
Estimation of parameters from a bivariate Markov regime switching bivariate copula model
Usage
EstHMMCop(y, reg, family, max_iter, eps)
Arguments
y | 
 (nx2) data matrix (observations or residuals) that will be transformed to pseudo-observations  | 
reg | 
 number of regimes  | 
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
max_iter | 
 maximum number of iterations of the EM algorithm  | 
eps | 
 precision (stopping criteria); suggestion 0.0001.  | 
Value
theta | 
 (1 x reg) estimated parameter of the copula according to CRAN copula package (except for Frank copula, where theta = log(theta_R_Package)) for each regime (except for degrees of freedom)  | 
dof | 
 estimated degree of freedom, only for the Student copula  | 
Q | 
 (reg x reg) estimated transition matrix  | 
eta | 
 (n x reg) conditional probabilities of being in regime k at time t given observations up to time t  | 
tau | 
 estimated Kendall tau for each regime  | 
U | 
 (n x 2) matrix of Rosenblatt transforms  | 
cvm | 
 Cramer-von-Mises statistic for goodness-of-fit  | 
W | 
 regime probabilities for the conditional distribution given the past Kendall's tau  | 
Author(s)
Mamadou Yamar Thioub and Bruno Remillard, April 12, 2018
References
<doi::10.1002/cjs.11534>
Examples
Q <- matrix(c(0.8, 0.3, 0.2, 0.7),2,2) ; kendallTau <- c(0.3 ,0.7) ;
data <- SimHMMCop(Q, 'clayton', kendallTau, 10)$SimData;
estimations <- EstHMMCop(data,2,'clayton',10000,0.0001)
Sample Kendall's tau Estimation
Description
This function estimates the sample Kendall's tau of a bivariate data matrix
Usage
EstKendallTau(X)
Arguments
X | 
 (n x 2) matrix  | 
Value
KendallTau | 
 estimated sample Kendall's tau of the data  | 
Estimation of bivariate mixture bivariate copula model
Description
Estimation of parameters from a mixture of bivariate copula models
Usage
EstMixtureCop(y, reg, family, max_iter, eps)
Arguments
y | 
 (nx2) data matrix (observations or residuals) that will be transformed to pseudo-observations  | 
reg | 
 number of regimes  | 
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
max_iter | 
 maximum number of iterations of the EM algorithm  | 
eps | 
 precision (stopping criteria); suggestion 0.0001.  | 
Value
theta | 
 (1 x reg) estimated parameter of the copula according to CRAN copula package (except for Frank copula, where theta = log(theta_R_Package)) for each component (except for degrees of freedom)  | 
dof | 
 estimated degree of freedom, only for the Student copula  | 
Q | 
 (1 x reg) estimated weights vector  | 
eta | 
 (n x reg) conditional probabilities of being in regime k at time t given observations up to time t  | 
tau | 
 estimated Kendall tau for each regime  | 
U | 
 (n x 2) matrix of Rosenblatt transforms  | 
cvm | 
 Cramer-von-Mises statistic for goodness-of-fit  | 
Author(s)
Mamadou Yamar Thioub and Bruno Remillard, April 12, 2018
References
<doi::10.1002/cjs.11534>
Goodness-of-fit of Markov regime switching bivariate copula model
Description
Goodness-of-fit test of a Markov regime switching bivariate copula model
Usage
GofHMMCop(R, reg, family, max_iter, eps, n_sample, n_cores)
Arguments
R | 
 (n x 2) data matrix that will be transformed to pseudo-observations  | 
reg | 
 number of regimes  | 
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
max_iter | 
 maxmimum number of iterations of the EM algorithm  | 
eps | 
 precision (stopping criteria); suggestion 0.0001  | 
n_sample | 
 number of bootstrap; suggestion 1000  | 
n_cores | 
 number of cores to use in the parallel computing  | 
Value
pvalue | 
 pvalue (significant when the result is greater than 5)  | 
theta | 
 (1 x reg) estimated parameter of the copula according to CRAN copula package (except for Frank copula, where theta = log(theta_R_Package)) for each regime (except for degrees of freedom)  | 
dof | 
 estimated degree of freedom, only for the Student copula  | 
Q | 
 (reg x reg) estimated transition matrix  | 
eta | 
 (n x reg) conditional probabilities of being in regime k at time t given observations up to time t  | 
tau | 
 estimated Kendall tau for each regime  | 
U | 
 (n x 2) matrix of Rosenblatt transforms  | 
cvm | 
 Cramer-von-Mises statistic for goodness-of-fit  | 
W | 
 regime probabilities for the conditional distribution given the past Kendall's tau  | 
References
<doi::10.1002/cjs.11534>
Goodness-of-fit of mixture bivariate copula model
Description
Goodness-of-fit test of a mixture bivariate copula model
Usage
GofMixtureCop(R, reg, family, max_iter, eps, n_sample, n_cores)
Arguments
R | 
 (nx2) data matrix (observations or residuals) that will be transformed to pseudo-observations  | 
reg | 
 number of regimes  | 
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
max_iter | 
 maxmimum number of iterations of the EM algorithm  | 
eps | 
 precision (stopping criteria); suggestion 0.0001  | 
n_sample | 
 number of bootstrap; suggestion 1000  | 
n_cores | 
 number of cores to use in the parallel computing  | 
Value
pvalue | 
 pvalue (significant when the result is greater than 5)  | 
theta | 
 (1 x reg) estimated parameter of the copula according to CRAN copula package (except for Frank copula, where theta = log(theta_R_Package)) for each component (except for degrees of freedom)  | 
dof | 
 estimated degree of freedom, only for the Student copula  | 
Q | 
 (1 x reg) estimated weights vector  | 
eta | 
 (n x reg) conditional probabilities of being in regime k at time t given observations up to time t  | 
tau | 
 estimated Kendall tau for each regime  | 
U | 
 (n x 2) matrix of Rosenblatt transforms  | 
cvm | 
 Cramer-von-Mises statistic for goodness-of-fit  | 
Author(s)
By Bruno Remillard, Nov 28, 2010
References
<doi::10.1002/cjs.11534>
Kendall's tau of a copula
Description
Computation of Kendall's tau of a copula family with an unconstrainted parameter alpha.
Usage
KendallTau(family, alpha)
Arguments
family | 
 "gaussian" , "t" , "clayton" , "frank" , "gumbel"  | 
alpha | 
 unconstrainted parameters of the copula family  | 
Value
tau | 
 estimated Kendall's tau  | 
Theta estimation
Description
Parameters of a copula according to CRAN copula package (except for Frank copula, where theta = log(theta_R_Package)), corresponding to the unconstrainted parameters alpha.
Usage
ParamCop(family, alpha)
Arguments
family | 
 "gaussian" , "t" , "clayton" , "frank" , "gumbel"  | 
alpha | 
 unconstrainted parameters of the copula family  | 
Value
theta | 
 matlab parameters  | 
Alpha estimation
Description
Unconstrainted parameter for a given Kendall's tau.
Usage
ParamTau(family, tau)
Arguments
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
tau | 
 Kendall's tau of the copula family  | 
Value
alpha | 
 estimated unconstrainted parameter  | 
Rosenblatt transform for Clayton copula
Description
Computation of the Rosenblatt transform fot Clayton's copula
Usage
RosenblattClayton(u, theta)
Arguments
u | 
 (n x d) matrix of pseudos-observations (normalized ranks)  | 
theta | 
 parameter of the Clayton copula  | 
Value
R | 
 Rosenblatt transform  | 
Rosenblatt transform for Frank copula
Description
Computation of the Rosenblatt transform for Frank's copula
Usage
RosenblattFrank(U, theta)
Arguments
U | 
 (n x d) matrix of pseudos-observations (normalized ranks)  | 
theta | 
 parameter of the Frank copula  | 
Value
R | 
 Rosenblatt transform  | 
Rosenblatt transform for Gaussian copula
Description
Computation of the Rosenblatt transform for the Gaussian copula
Usage
RosenblattGaussian(u, rho)
Arguments
u | 
 (n x d) matrix of pseudos-observations (normalized ranks)  | 
rho | 
 (d x d) correlation matrix, or the correlation coefficient (if, d = 2)  | 
Value
R | 
 Rosenblatt transform  | 
Rosenblatt transform for Gumbel copula
Description
Computation of the Rosenblatt transform for Gumbel's copula
Usage
RosenblattGumbel(U, theta)
Arguments
U | 
 (n x d) matrix of pseudos-observations (normalized ranks)  | 
theta | 
 parameter of the Gumbel copula  | 
Value
R | 
 Rosenblatt transform  | 
Rosenblatt transform for Student copula
Description
Computation of the Rosenblatt transform for the Student copula
Usage
RosenblattStudent(u, rho, nu)
Arguments
u | 
 (n x d) matrix of pseudos-observations (normalized ranks)  | 
rho | 
 (d x d) correlation matrix  | 
nu | 
 degrees of freedom  | 
Value
R | 
 Rosenblatt transform  | 
Simulation of bivariate Markov regime switching copula model
Description
Simulaion of values from a bivariate Markov regime switching copula model
Usage
SimHMMCop(Q, family, KendallTau, n, DoF)
Arguments
Q | 
 Transition probality matrix (d x d);  | 
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
KendallTau | 
 Kendall's rank correlation  | 
n | 
 number of simulated vectors  | 
DoF | 
 degree of freedom only for the Student copula  | 
Value
SimData | 
 Simulated Data  | 
MC | 
 Markov chain regimes  | 
alpha | 
 parameters alpha  | 
Examples
Q <- matrix(c(0.8, 0.3, 0.2, 0.7),2,2) ; kendallTau <- c(0.3 ,0.7) ;
simulations <- SimHMMCop(Q, 'gumbel', kendallTau, 300)
Markov chain simulation
Description
Simulation of n consecutive values of a Markov chain with transition matrix Q, starting from a state eta0 or the uniform distribution on the set 1,..., r.
Usage
SimMarkovChain(Q, n, eta0)
Arguments
Q | 
 Transition probability matrix (d x d)  | 
n | 
 number of simulated vectors  | 
eta0 | 
 variable eta  | 
Value
x | 
 Simulated Markov chain sequence  | 
Simulation of bivariate mixture copula model
Description
Simulation of observations from a bivariate mixture copula model
Usage
SimMixtureCop(Q, family, KendallTau, n, DoF)
Arguments
Q | 
 Weights vector (1 x component);  | 
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
KendallTau | 
 Kendall's rank correlation  | 
n | 
 number of simulated vectors  | 
DoF | 
 vector of degree of freedom only for the Student copula  | 
Value
SimData | 
 Simulated Data  | 
MC | 
 Markov chain regimes  | 
alpha | 
 parameters alpha  | 
Examples
Q <- matrix(c(0.8, 0.2),1,2) ; kendallTau <- c(0.3 ,0.7) ;
simulations <- SimMixtureCop(Q, 'gaussian', kendallTau, 300)
Cramer-von Mises statistic SnB for GOF based on the Rosenblatt transform
Description
Computation of the Cramer-von Mises statistic SnB for GOF based on the Rosenblatt transform
Usage
SnB(E)
Arguments
E | 
 (n x d) matrix of pseudos-observations (normalized ranks)  | 
Value
Sn | 
 Cramer-von Mises statistic  | 
Spearman's rho
Description
Value of Spearman's rho corresponding to a constrainted (matlab) parameter theta for a copula family.
Usage
Tau2Rho(family, theta)
Arguments
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
theta | 
 parameter of the copula according to CRAN copula package (except for Frank copula, where theta = log(theta_R_Package))  | 
Value
rho | 
 estimated Spearman's rho  | 
Bootstrap function for a bivariate copula models
Description
Bootstrapping function needed for parallel computing
Usage
bootstrapfun(Q, family, tau, n, df, max_iter, eps, HMM)
Arguments
Q | 
 Weights vector (1 x reg or component);  | 
family | 
 'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel'  | 
tau | 
 Kendall's rank correlation  | 
n | 
 number of simulated vectors  | 
df | 
 vector of degree of freedom (d x 1), only for the Student copula.  | 
max_iter | 
 maximum number of iterations for estimation  | 
eps | 
 precision (e.g 0.00001);  | 
HMM | 
 1 (if HMM) , 0 (if mixture);  | 
Value
theta1 | 
 Estimated copula parameters  | 
Q1 | 
 Estimated transition matrix  | 
eta1 | 
 Estimated probabilites for regimes  | 
tau1 | 
 Estimated Kendall's tau  | 
dof1 | 
 Estimated degrees of freedom for the Student copula  | 
Usim | 
 Estimated pseudo-observations  | 
cvm_sim | 
 Estimated Cramer-von Mises statistic  | 
Author(s)
Mamadou Yamar Thioub and Bruno Remillard, April 12, 2018
COPULAPDF Probability density function for a copula.
Description
COPULAPDF probability density function for a copula with linear correlation parameters RHO and
Usage
copulaFamiliesPDF(family, u, ...)
Arguments
family | 
 copula familly= "gaussian" , "t" , "clayton" , "frank" , "gumbel"  | 
u | 
 is an N-by-P matrix of values in [0,1], representing N points in the P-dimensional unit hypercube  | 
... | 
 additionnal parameter like RHO a P-by-P correlation matrix.  | 
Value
Y = COPULAPDF('Gaussian',U,RHO) returns the probability density of the Gaussian copula with linear correlation parameters RHO, evaluated at the points in U. U is an N-by-P matrix of values in [0,1], representing N points in the P-dimensional unit hypercube. RHO is a P-by-P correlation matrix. If U is an N-by-2 matrix, RHO may also be a scalar correlation coefficient.
Y = COPULAPDF('t',U,RHO,NU) returns the probability density of the t copula with linear correlation parameters RHO and degrees of freedom parameter NU, evaluated at the points in U. U is an N-by-P matrix of values in [0,1]. RHO is a P-by-P correlation matrix. If U is an N-by-2 matrix, RHO may also be a scalar correlation coefficient.
Y = COPULAPDF(FAMILY,U,ALPHA) returns the probability density of the bivariate Archimedean copula determined by FAMILY, with scalar parameter ALPHA, evaluated at the points in U. FAMILY is 'Clayton', 'Frank', or 'Gumbel'. U is an N-by-2 matrix of values in [0,1].
Examples
 u = seq(0,1,0.1);
    U1=matrix(rep(u,length(u)),nrow=length(u),byrow = TRUE); U2=t(U1)
   F = copulaFamiliesPDF('clayton',cbind(c(U1), c(U2)),1)
Dilogarithm function
Description
Computation of the dilogarithm function by nemerical integration.
Usage
dilog(x)
Arguments
x | 
 a real number  | 
Value
out | 
 dilogarithm  |