# GARCH mean and volatility spillover R commands needed

I analyzed an MA(1)-GARCH(1,1) model in R, and now I want to test the conditional mean and volatility spillover effect between the two time series (exchange rates) (based on Hamao et al., 1990). Therefore I have to include the exogenous variable from the other stock market. Here is the model:

$R_{j,t-1}$ is the previous currency exchange rates and $\sigma^2_{j,t-1}$ is the squared residual derived from the MA(1)-GARCH(1,1) model applied to $R_{j,t-1}$. I understand the model, but I don’t know how to run this in R.

What are the R commands for that?

• My first thought was that this might be better suited for Stats SE - but it already got closed there for being purely about programming. – LocalVolatility Apr 25 '17 at 15:57
• I would look at rugarch or rmgarch and see either fits your needs. If not, you might have to write your own function. – John Apr 25 '17 at 17:44
• Using package "rugarch" in R, specify your model with ugarchspec and estimate it with ugarchfit. The specification will use external.regressors=cbind(x) inside variance.model where x is the vector corresponding to $\varepsilon^2_{j,t-1}$. – Richard Hardy Apr 25 '17 at 18:29
• I am trying to run the model, but how do I get the result for mean spillover and the volatility spillover? Do I have to put the external.regressor into the mean.model in R? This is my specification in R: spec = ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1,1), external.regressors = cbind(log$SPOT.mat), variance.targeting = TRUE), mean.model = list( armaOrder = c(0,1), include.mean = TRUE), distribution.model = "norm") modelfit=ugarchfit(data=log$NDF.mat) modelfit PLEASE HELP!! – Ellen May 3 '17 at 19:04
• Ellen, you need to include @RichardHardy in your comment, otherwise I do not get notified. I have updated the answer now. Also, when posting code, use backticks () in front and at the end to have proper formatting, e.g. this is code. – Richard Hardy May 5 '17 at 9:38

If you were interested in including exogenous1 or predetermined regressors in the conditional mean and variance specifications of a univariate time series, you could do that using the package "rugarch" in R. There you can specify your model with the function ugarchspec and estimate it with ugarchfit. The specification will use

• external.regressors=cbind(x.mean) inside mean.model where x.mean is the vector corresponding to $R_{j,t−1}$ (for conditional mean spillover);
• external.regressors=cbind(x.variance) inside variance.model where x.variance is the vector corresponding to $\varepsilon^2_{j,t−1}$ (for conditional variance spillover).

Now in your case the extra regressors both in the conditional mean and the conditional variance equation are endogenous (tricky!). To estimate the model consistently and efficiently, you would need to use a (restricted) VARMA-MGARCH model where the MGARCH part is a restricted BEKK-GARCH model, for example. However, the implementation can be quite problematic in practice as there are few software packages that accommodate this model (I think it is available in RATS, but not sure if anywhere else). I do not see an easy way around the problem unless you are willing to simplify the model (e.g. remove the MA components from the condiitonal mean model). For example, using two-stage modelling (first conditional mean, then conditional variance) is not really an option as that could affect consistency (let alone efficiency) of the estimators.

1 exogenous = determined outside the system being modelled

• Do I need to run the model without external regressors to extract x.mean and x.variance? Something like x.variance=modelfitpre@fit$residuals^2 and x.mean=modelfitpre@fit$fitted.values – Seth May 5 '17 at 15:30
• @Seth, My answer works best for truly exogenous regressors. If the regressor is determined within the system, an (appropriately restricted) VARMA-MGARCH model would be a cleaner approach. – Richard Hardy May 5 '17 at 15:52
• I am trying to figure out what x.mean and x.variance would be for the original model above if the external regressor was really exogenous. I realize my previous comment made no sense. – Seth May 5 '17 at 16:39
• @Seth, in your previous comment, you got x.variance right but not x.mean. x.mean is just the raw series $R_{j,t-1}$, not fitted values $\hat R_{j,t-1}$. – Richard Hardy May 5 '17 at 16:41