Description
Summary
It would be cool to be able to model sigma as a garch process.
Description
After closing #708, brms can support autocor processes in the formula syntax ala
fit <- brm(y ~ arma(p = 2, q = 2), data = list(y = y),
inits = 0)
Though this is only available on the main terms (Paul is that right?) and not distribution parameters.
For some parameters there are specific autocorrelation models like the General Autoregressive Conditional Heteroskedasticity (garch) and general volatility models. Garch are used pretty frequently there are several stan implementations of them such as varstan. So I think it would be nice to add these given the new formula syntax
Example
For a model written with either student or normal distributions like
fit <- brm(y ~ arma(p = 2, q = 2),
sigma ~ garch(p = 2, rr =2), data = list(y = y), inits = 0)
The stan code could look something like
for (n in 1:N) {
// standard arma stuff
mu[n] += Err[n, 1:Kma] * ma;
err[n] = Y[n] - mu[n];
for (i in 1:J_lag[n]) {
Err[n + 1, i] = err[n + 1 - i];
}
mu[n] += Err[n, 1:Kar] * ar;
// garch stuff
// pretend we have a pow that does elementwise
sigma[n] += pow(Err[n, 1:GKar], 2) * g_ar;
for (i in 1:G_lag[n]) {
sigma_lag[n + 1, i] = sigma[n + 1 - i];
}
sigma[n] += pow(sigma_lag[n, 1:GKrr], 2) * g_rr;
}
Some Qs
- Is it okay if these are just limited to normal and student (what does arma currently support for cov=FALSE)?
- Do you want a list of other parameterized models that would probably be reasonable to build out? Would things like bsts be in scope of that?
If you have the time to write an outline on what needs to be done to add new autocor I wouldn't mind taking a shot at adding garch and some of it's variants. I posted about this before but imo I think this would also be a good GSOC or summer intern problem. Either way, if we can get the garch one out in the next few months I can probably do a talk about it at R in Finance to get some other contributors