# Regression model with GARCH (1, 1) error term

I am attempting to analyze the relationship between exchange rates and stock market prices using the regression model below.

What software package can I use to achieve this? How would I get the variables $a, \beta_1$ and $\varepsilon_t$?

Model: bivariate regression model with GARCH (1, 1) error term ($\varepsilon_t$):

$$\log (EX_t) = a + \beta_1 \log (SP_t) + \varepsilon_t.$$

The level exchange rate series is denoted by $EX$ and first difference data for $EX$ (denoted $EX_1$) is equal to $\log (EX_t/EX_{t-1})$. Level stock price series is denoted by $SP$ and first difference data for $SP$ (denoted $SP_1$) is equal to $\log (SP_t/SP_{t-1})$.

• Try "rugarch" package for R. It allows specifying an ARMA-GARCH model with exogenous regressors in both the conditional mean and the conditional variance equations. You will need to select ARMA order of (0,0) and specify $\log(SP_t)$ as exogenous regressor in the conditional mean. Use functions ugarchspec for model specification and then ugarchfit for model estimation. Note that your variable will likely be integrated, which is why you will need to use first differences instead of levels (I do not expect them to be cointegrated, but that would require including an error correction term). Mar 22, 2017 at 10:53
• Also, consider whether $SP_t$ might be endogenous. If so, you will have the endogeneity bias, yielding biased and inconsistent estimates. Mar 22, 2017 at 10:56
• I have used the commands below as an example in R. I am very new to R. how do I extract the variables a and ß1 for the model that best fits? Mar 22, 2017 at 11:12
• Step1: require(rugarch) Step2: data <- cbind(rnorm(1000),rnorm(1000)) Step3: spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1), + submodel = NULL, external.regressors = NULL, variance.targeting = FALSE), + mean.model = list(armaOrder = c(0, 0), external.regressors = matrix(data[,2]), + distribution.model = "norm", start.pars = list(), fixed.pars = list())) Step4: garch <- ugarchfit(spec=spec,data=data[,1],solver.control=list(trace=0)) Mar 22, 2017 at 11:12
• Check the so-called "methods" applicable for the class of output that is generated by ugarchfit; they will be listed under that class in the package manual. Also try slotNames(garch) to see what is inside the fitted object. The slots can be accessed by garch@slotname. Further inside you might need the $ operator to extract elements of the slots, such as garch@slotname$elementname, something like that. Element names are found by names(garch@slotname). Mar 22, 2017 at 11:14

## 2 Answers

Try "rugarch" package for R. It allows specifying an ARMA-GARCH model with exogenous regressors in both the conditional mean and the conditional variance equations. You will need to select ARMA order of (0,0) and specify $\log(SP_t)$ as an exogenous regressor in the conditional mean. Use functions ugarchspec for model specification and then ugarchfit for model estimation. Something like:

spec = ugarchspec(mean.model = list(armaOrder = c(0, 0), external.regressors = cbind(log(SP)))
fit = ugarchfit(spec=spec, data=log(EX))


Note that your variables will likely be integrated, which is why you will need to use first differences instead of levels (I do not expect them to be cointegrated, in which case you might need to include an error correction term in the equation). Thus something like:

spec = ugarchspec(mean.model = list(armaOrder = c(0, 0), external.regressors = cbind(diff(log(SP))))
fit = ugarchfit(spec=spec, data=diff(log(EX)))


Also, consider whether $\log(SP_t)$ might be endogenous. If so, you will have the endogeneity bias, yielding biased and inconsistent estimates of $\beta_1$. Moreover, consider whether the effect of $\log(SP)$ on $\log(EX)$ might have a time lag.

Richard Hardy has already given a good answer to your question. I am going to supplement this answer by giving some (unsolicited) advice on better framing of your problem. I hope this is helpful to you in presenting your model form more clearly.

At the moment your notation is no good - you are using the notation $EX_\text{subscript}$ to refer to two conflicting things. You denote the exchange rate values as $EX_t$, but you also use this notation for the first difference $EX_1 = EX_t/EX_{t-1}$. So as it stands, the notation $EX_1$ apparently refers both to the exchange rate value at time $t=1$, and contrarily, also to the first difference $EX_t/EX_{t-1}$ at an arbitrary time that is not specified in the notation. The same problem occurs for $SP_1$.

To fix this, you should choose different notation for your differences; the standard notational convention is to use the $\Delta$ symbol as a difference operator. With this notation you would write $\Delta \log EX_t = \log (EX_t / EX_{t-1})$ and $\Delta \log SP_t = \log (SP_t / SP_{t-1})$. Notice that this notation differentiates the first differences from the original series values, and it also keeps an explicit subscript reference to the time where the first difference is measured. Now, given that your model is not framed in terms of differences, you probably don't need to mention these at all for the purposes of your question, but if you are going to do so, you should adopt better notation.

• First difference of $x_t$ is normaly understood as $x_t-x_{t-1}$, not $\frac{x_t}{x_{t-1}}$, so the notation you are proposing is nonstandard. I see the OP is using it in a nonstandard way, too. I think it would be best to stick to standard terms. Jun 13, 2018 at 4:58
• Good point (+1) - I have edited to add the logarithms, which fixes this. Thanks for catching that.
– Ben
Jun 13, 2018 at 5:11