1
$\begingroup$

What I'm trying to do is estimate the following GARCH(1,1) model in R with the garchFit function from the fGarch package:


Mean equation:

$Y_t = a + bX_t + e_t$

$e_t = z_th_t^{0.5}$

$e_t \sim N(0,h_t)$, $z_t \sim N(0,1)$

Variance equation:

$h_t = \omega + k_0e^2_{t-1} + k_1h_{t-1}$


In the above, $Y_t$ is the response of my mean equation and $X_t$ is the predictor. I will estimate this equation within the GARCH framework because of heteroscedasticity of residuals.

I want estimates of both the mean equation and the variance equation (similar to what EViews would give). However, the garchFit function has two inputs that I'm concerned about:

  • formula - ARMA(m,n) + GARCH/APARCH(p,q) mean and variance specification

As you can see in my equations, my mean equation is not of the ARMA(m,n) form.

  • data - any univariate time series which can be converted into a timeSeries using the generic function as.timeSeries

I'm modeling both $Y_t$ and $X_t$ together; thus it shouldn't be univariate.

If I put this model through EViews, It'll give me parameter estimates of $a$ and $b$. This is what I want, but in R. In R, I can do garchFit(data=Y) (where Y is the column of $Y_t$), and it'll do a GARCH(1,1) over $Y_t = \mu(Y) + e_t$; but it doesn't give me $a$ or $b$ in the mean equation that I want!

$\endgroup$
5
$\begingroup$

The solution is to use another package called rugarch.

install.packages("rugarch")
require(rugarch)

Let's construct a (Tx2) matrix called data, where column 1 is $Y_t$ and column 2 is $X_t$.

data <- cbind(rnorm(1000),rnorm(1000))

We can then compute the GARCH(1,1) model that I described in my question:

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()))

garch <- ugarchfit(spec=spec,data=data[,1],solver.control=list(trace=0))

Comparing this to EViews: The R coefficient estimates that are greater than $0.01$ differ to the EViews estimates by approximately $1-2\%$, which is acceptable in my mind. $t$-statistics differ by more but it doesn't effect inference.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.