Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rolling estimation #88

Open
waynelapierre opened this issue Mar 7, 2021 · 1 comment
Open

rolling estimation #88

waynelapierre opened this issue Mar 7, 2021 · 1 comment

Comments

@waynelapierre
Copy link

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
Copy link
Owner

s-broda commented Mar 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants