# VEC GARCH (1,1) for 4 time series

I have to estimate a VEC GARCH(1,1) model in R. I already tried rmgarch, fGarch, ccgarch, mgarch, tsDyn. Has somebody estimated a model like that?

library(quantmod)
library(fBasics)
library(rmgarch)
library(fGarch)
library(parallel)
library(ccgarch)
library(mgarch) #from github vst/mgarch
library(tsDyn)
library(ggplot2)
#load data, time series closing prices, 10 year sample
#DAX 30
getSymbols('^GDAXI', src='yahoo', return.class='ts',from="2005-01-01",    to="2015-01-31")
GDAXI.DE=GDAXI[ , "GDAXI.Close"]
#S&P 500
getSymbols('^GSPC', src='yahoo', return.class='ts',from="2005-01-01", to="2015-01-31")
GSPC=GSPC[ , "GSPC.Close"]
#Credit Suisse Commodity Return Strat I
getSymbols('CRSOX', src='yahoo', return.class='ts',from="2005-01-01", to="2015-01-31")
CRSOX=CRSOX[ , "CRSOX.Close"]
#iShares MSCI Emerging Markets
getSymbols('EEM', src='yahoo', return.class='ts',from="2005-01-01", to="2015-01-31")
EEM=EEM[ , "EEM.Close"]
#calculating log returns of the time series
log_r1=diff(log(GDAXI.DE[39:2575]))
log_r2=diff(log(GSPC))
log_r3=diff(log(CRSOX))
log_r4=diff(log(EEM))
#return matrix
r_t=data.frame(log_r1, log_r2,log_r3, log_r4)
#GARCH estimation
#eGarch(1,1), not multivariate

#Vec Garch(1,1)
Est1=VECM(r_t,lag=1, estim="ML" )
print(Est1)


I think the VECM operator isn't useful for my purpose since I need a martrix of 4x4 for alpha and one 4x4 for beta plus 4x1 vector for omega. Can somebody help with a package or code?

VECM-GARCH models do not seem to be implemented in R as of now. However, if you are willing to accept some simplifications, you could perhaps be fine with the existing functionality.

Take, for example, the "rmgarch" package in R. It allows combining univariate conditional mean-conditional variance models with several multivariate GARCH models that take individual component models as inputs (DCC, GOGARCH, copula GARCH).

Consider a bivariate system $(x_{1,t},x_{2,t})$. You could use the functions ugarchspec and ugarchfit from the "rugarch" package to specify and fit individual models for $x_{1,t}$ and $x_{2,t}$ separately. These models would have

• a conditional mean part that would include own lags, lags of the other series and an error correction term via the argument external.regressors and
• a conditional variance part that would be the GARCH model of your choice.

You would have to estimate the error correction term in advance using, say, the Johansen procedure (function ca.jo in "vars" package).

So far you would in effect have specified and estimated a VEC model equation by equation, paying attention to the conditional heteroskedasticity via the univariate GARCH models (although the off-diagonal element of the conditional variance matrices would be neglected).

Given the specified component models, you would supply them to the relevant function in the "rmgarch" package to build the multivariate GARCH model of your choice (DCC, GOGARCH or copula GARCH).

One unpleasant aspect of this procedure is that it is not clear how you would select the autoregressive order incorporating the information from the conditional variance part. You could still select the autoregressive order by just neglecting the conditional variance part, though.

• Thanks for your answer i considered something like this procedure. I already changed my "strategy" and so my code. Could I ask you for a favor to look at my code at stackoverflow, stackoverflow.com/questions/35554228/… ? maybe you can give me an advice on this one too. The probleme with the strategy above is that i need the off diagonals for another part. i need this code for my master thesis so I am not allowed to build it step by step. – Nils Feb 26 '16 at 9:27