2.2 Modeling temporal heteroscedasticity
A set of variables is homoscedastic if their variances are all the same; the variables are heteroscedastic if they do not all have the same variance. Heteroscedastic time-series models allow the noise term to vary over time.
GARCH(1,1) models
The basic generalized autoregressive conditional heteroscedasticity (GARCH) model, GARCH(1,1), extends the ARCH(1) model by including the squared previous difference in return from the mean at time \(t-1\) as a predictor of volatility at time \(t\), defining \[ \sigma^2_t = \alpha_0 + \alpha_1 a^2_{t-1} + \beta_1 \sigma^2_{t-1}. \]
To ensure the scale term is positive and the resulting time series stationary, the coefficients must all satisfy \(\alpha_0, \alpha_1, \beta_1 > 0\) and the slopes \(\alpha_1 + \beta_1 < 1\).
data {
int<lower=0> T;
array[T] real r;
real<lower=0> sigma1;
}parameters {
real mu;
real<lower=0> alpha0;
real<lower=0, upper=1> alpha1;
real<lower=0, upper=(1-alpha1)> beta1;
}transformed parameters {
array[T] real<lower=0> sigma;
1] = sigma1;
sigma[for (t in 2:T) {
sigma[t] = sqrt(alpha01] - mu, 2)
+ alpha1 * pow(r[t - 1], 2));
+ beta1 * pow(sigma[t -
}
}model {
r ~ normal(mu, sigma); }
To get the recursive definition of the volatility regression off the
ground, the data declaration includes a non-negative value
sigma1
for the scale of the noise at \(t = 1\).
The constraints are coded directly on the parameter declarations.
This declaration is order-specific in that the constraint on beta1
depends on the value of alpha1
.
A transformed parameter array of non-negative values sigma
is
used to store the scale values at each time point. The definition of
these values in the transformed parameters block is where the
regression is now defined. There is an intercept alpha0
, a
slope alpha1
for the squared difference in return from the mean
at the previous time, and a slope beta1
for the previous noise
scale squared. Finally, the whole regression is inside the
sqrt
function because Stan requires scale (deviation) parameters (not
variance parameters) for the normal distribution.
With the regression in the transformed parameters block, the model
reduces a single vectorized sampling statement. Because r
and
sigma
are of length T
, all of the data are modeled
directly.