# Initialization and reconstruction of conditional variance in a GARCH model

I have a general understanding of the GARCH model, but I'm confused with two things about the conditional volatility.

The past values of the conditional volatility are given by the updating formula. I ran a model with garchFit in "fGarch" package in R and extracted the parameters:

alpha = coef(model)["alpha1"]
beta = coef(model)["beta1"]
w = coef(model)["omega"]


I then calculated by hand the value of the conditional variance at time t=3 (just an example):

w + alpha*model@h.t + beta*squaredReturns


It gave me 0.0002843326. However, this is different from model@h.t, which equals 0.000284847. Of course it is a small difference, but since I thought that this equation was exactly the way the model@h.t (conditional variance) was calculated, then I'm definitely missing something.

My second question has to do with the initialization. If this equation is indeed the way the conditional variance is calculated, then how is the value in t=1 calculated, since there are no values for return and variance in t=0?

I will attempt answering question 2. (Question 1 remains open.)

I checked an article about the "fGarch" package: Wurtz et al. "Parameter Estimation of ARMA Models with GARCH/APARCH Errors: An R and SPlus Software Implementation".

It seems that the initial value of the conditional variance, $\sigma^2_0$, is taken to be the unconditional variance of the sample (with $n$ rather than $n-1$ in the denominator) -- see p. 6 in the article cited above, particularly line 21: h = filter(e, beta, "r", init = Mean). Here I suppose init stands for the initial value of the conditional variance, and Mean is the mean of squared errors as defined in line 18. I am not completely sure, though.

Similarly, the initial value of the squared error, $\varepsilon_0^2$, seems to be the same as $\sigma^2_0$, i.e. Mean -- as can be seen in line 20: e = omega + alpha * c(Mean, z[-length(x)]^2).

Interestingly, at the bottom of p. 5 the article discusses the inital value selection for all other parameters ($\mu = \bar x$, $\omega = 0.1 \cdot \widehat{\text{Var}}(x)$, $\alpha = 0.1$, $\beta = 0.8$) but not for $\sigma^2_0$. I wonder why they did not make it explicit for $\sigma^2_0$. Perhaps I am missing something.

I just came across the same issue. For your first Q1, note that beta1 is the coefficient that corresponds to the lagged volatility while alpha1 corresponds to the residual one. If you are assuming that returns have conditional mean of zero, then you can use the squared returns instead of the residuals. But this should not be the case otherwise. In any case, the following code illustrates how to achieve the same results from the function:

library(fGarch)
library(Quandl)

sp <- Quandl("YAHOO/INDEX_GSPC", start_date="2010-01-01")
sp <- sp[order(sp$Date),] y <- sp$Adjusted Close[2:nrow(sp)]/sp\$Adjusted Close[1:(nrow(sp)-1)] - 1

h.t <- g@h.t
eps <- g@residuals
B <- coef(g)
h.v <- B + var(y)*B + var(y)*B
for(i in 2:length(h.t)) {
h.v[i] <- B + h.v[i-1]*B + (eps[i-1]^2)*B
}

plot(h.v~h.t, pch = 20, cex = 0.5)
abline(a=0,b=1) 