# cDCC GARCH model in R

Hello i'm trying to estimate a correlation matrix. The algorithm seems to work, but i have two questions. How do i test it ( do i have to necessarily perform simulations ?) . And i couldn't anderstand what the argument ts in cdcc_estimation is for.

``````library(rugarch)
library(xdcclarge)

n<-6
mydata=mydata[,c(21,23,55,58,64,66)]

# Step 1:GARCH Parameter Estimation with rugarch

spec = ugarchspec()
mspec = multispec( replicate(spec, n = n) )
fitlist = multifit(multispec= mspec, data = mydata)
ht<-sigma(fitlist)^2    # les variances conditionnelles
residuals<-residuals(fitlist)

# Step 2:cDCC-GARCH Parameter Estimation with xdcclarge
cDCC<-cdcc_estimation(ini.para=c(0.05,0.93) ,ht ,residuals,method="NLS", ts=1)
#Time varying correlation matrix Rt at time t
(Rt<-matrix(cDCC\$cdcc_Rt,n,n))
``````

As for this part, the description for `cdcc_estimation()` is:

This function estimates the parameters(alpha,beta) and time-varying correlation matrices(Rt) of cDCC-GARCH model.

It returns "time-varying correlations(Rt) and the result of estimation" where "Rt are vectorized values of the conditional correlation matrix(Rt) until time t(ts) for each row."

The argument `ts` is ts how many time series are you taking(default:1 latest value).

There's a great post on testing statistical code here:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.