s-broda / ARCHModels.jl

A Julia package for estimating ARMA-GARCH models.
https://juliaeconometrics.wordpress.com/
Other
90 stars 18 forks source link

rolling estimation #88

Open waynelapierre opened 3 years ago

waynelapierre commented 3 years ago

It would be great if this package could provide some rolling estimation features. rugarch has this feature: https://cran.r-project.org/web/packages/rugarch/vignettes/Introduction_to_the_rugarch_package.pdf

s-broda commented 3 years ago

That's certainly possible, though I feel that this is more flexibly handled on the user side. It's just a few lines of code really. There's an example for VaR backtesting in this notebook: https://github.com/s-broda/brownbag2018/blob/master/brownbag.ipynb

Basically the code amounts to

T = length(data)
windowsize = 1000
vars = similar(data); fill!(vars, NaN)
for t = windowsize+1:T-1
    m = fit(GARCH{1, 1}, data[t-windowsize:t])
    vars[t+1] = predict(m, :VaR; level=0.05)    
end

Fitting these 7334 models takes 20 seconds :)

Having said that, I'm not necessarily opposed to the idea. I just lack the time at the moment. If somebody wants to take this up, they are more than welcome to.