Title: | Markov Regime Switching Copula Models Estimation and Goodness-of-Fit |
---|---|
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>. |
Authors: | Bouchra R. Nasri [aut], Bruno N Remillard [aut, cre, cph], Mamadou Yamar Thioub [aut], Romanic Pieugueu [aut] |
Maintainer: | Bruno N Remillard <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1.0 |
Built: | 2024-12-02 06:49:14 UTC |
Source: | CRAN |
COPULACDF Cumulative probability function for a copula with linear correlation parameters RHO
CopulaFamiliesCDF(family, u, ...)
CopulaFamiliesCDF(family, u, ...)
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. |
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].
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)
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)
Computation of the dilogarithm function by nemerical integration.
dilog(x)
dilog(x)
x |
a real number |
out |
dilogarithm |
Estimation of parameters from a bivariate Markov regime switching bivariate copula model
EstHMMCop(y, reg, family, max_iter, eps)
EstHMMCop(y, reg, family, max_iter, eps)
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. |
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 |
Mamadou Yamar Thioub and Bruno Remillard, April 12, 2018
<doi::10.1002/cjs.11534>
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)
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)
This function estimates the sample Kendall's tau of a bivariate data matrix
EstKendallTau(X)
EstKendallTau(X)
X |
(n x 2) matrix |
KendallTau |
estimated sample Kendall's tau of the data |
Estimation of parameters from a mixture of bivariate copula models
EstMixtureCop(y, reg, family, max_iter, eps)
EstMixtureCop(y, reg, family, max_iter, eps)
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. |
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 |
Mamadou Yamar Thioub and Bruno Remillard, April 12, 2018
<doi::10.1002/cjs.11534>
Goodness-of-fit test of a Markov regime switching bivariate copula model
GofHMMCop(R, reg, family, max_iter, eps, n_sample, n_cores)
GofHMMCop(R, reg, family, max_iter, eps, n_sample, n_cores)
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 |
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 |
<doi::10.1002/cjs.11534>
Goodness-of-fit test of a mixture bivariate copula model
GofMixtureCop(R, reg, family, max_iter, eps, n_sample, n_cores)
GofMixtureCop(R, reg, family, max_iter, eps, n_sample, n_cores)
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 |
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 |
By Bruno Remillard, Nov 28, 2010
<doi::10.1002/cjs.11534>
Computation of Kendall's tau of a copula family with an unconstrainted parameter alpha.
KendallTau(family, alpha)
KendallTau(family, alpha)
family |
"gaussian" , "t" , "clayton" , "frank" , "gumbel" |
alpha |
unconstrainted parameters of the copula family |
tau |
estimated Kendall's tau |
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.
ParamCop(family, alpha)
ParamCop(family, alpha)
family |
"gaussian" , "t" , "clayton" , "frank" , "gumbel" |
alpha |
unconstrainted parameters of the copula family |
theta |
matlab parameters |
Unconstrainted parameter for a given Kendall's tau.
ParamTau(family, tau)
ParamTau(family, tau)
family |
'gaussian' , 't' , 'clayton' , 'frank' , 'gumbel' |
tau |
Kendall's tau of the copula family |
alpha |
estimated unconstrainted parameter |
Computation of the Rosenblatt transform fot Clayton's copula
RosenblattClayton(u, theta)
RosenblattClayton(u, theta)
u |
(n x d) matrix of pseudos-observations (normalized ranks) |
theta |
parameter of the Clayton copula |
R |
Rosenblatt transform |
Computation of the Rosenblatt transform for Frank's copula
RosenblattFrank(U, theta)
RosenblattFrank(U, theta)
U |
(n x d) matrix of pseudos-observations (normalized ranks) |
theta |
parameter of the Frank copula |
R |
Rosenblatt transform |
Computation of the Rosenblatt transform for the Gaussian copula
RosenblattGaussian(u, rho)
RosenblattGaussian(u, rho)
u |
(n x d) matrix of pseudos-observations (normalized ranks) |
rho |
(d x d) correlation matrix, or the correlation coefficient (if, d = 2) |
R |
Rosenblatt transform |
Computation of the Rosenblatt transform for Gumbel's copula
RosenblattGumbel(U, theta)
RosenblattGumbel(U, theta)
U |
(n x d) matrix of pseudos-observations (normalized ranks) |
theta |
parameter of the Gumbel copula |
R |
Rosenblatt transform |
Computation of the Rosenblatt transform for the Student copula
RosenblattStudent(u, rho, nu)
RosenblattStudent(u, rho, nu)
u |
(n x d) matrix of pseudos-observations (normalized ranks) |
rho |
(d x d) correlation matrix |
nu |
degrees of freedom |
R |
Rosenblatt transform |
Simulaion of values from a bivariate Markov regime switching copula model
SimHMMCop(Q, family, KendallTau, n, DoF)
SimHMMCop(Q, family, KendallTau, n, DoF)
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 |
SimData |
Simulated Data |
MC |
Markov chain regimes |
alpha |
parameters alpha |
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)
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)
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.
SimMarkovChain(Q, n, eta0)
SimMarkovChain(Q, n, eta0)
Q |
Transition probability matrix (d x d) |
n |
number of simulated vectors |
eta0 |
variable eta |
x |
Simulated Markov chain sequence |
Simulation of observations from a bivariate mixture copula model
SimMixtureCop(Q, family, KendallTau, n, DoF)
SimMixtureCop(Q, family, KendallTau, n, DoF)
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 |
SimData |
Simulated Data |
MC |
Markov chain regimes |
alpha |
parameters alpha |
Q <- matrix(c(0.8, 0.2),1,2) ; kendallTau <- c(0.3 ,0.7) ; simulations <- SimMixtureCop(Q, 'gaussian', kendallTau, 300)
Q <- matrix(c(0.8, 0.2),1,2) ; kendallTau <- c(0.3 ,0.7) ; simulations <- SimMixtureCop(Q, 'gaussian', kendallTau, 300)
Computation of the Cramer-von Mises statistic SnB for GOF based on the Rosenblatt transform
SnB(E)
SnB(E)
E |
(n x d) matrix of pseudos-observations (normalized ranks) |
Sn |
Cramer-von Mises statistic |
Value of Spearman's rho corresponding to a constrainted (matlab) parameter theta for a copula family.
Tau2Rho(family, theta)
Tau2Rho(family, theta)
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)) |
rho |
estimated Spearman's rho |