Problem with a rolling regression
Posted: Sun Jun 15, 2025 10:02 am
Dear Tom,
I have developed a model to forecast the price development of Bitcoins. I have four lagged independent variables without a constant in a linear regression. However, the residuals are autorcorrelated. A test with BJAUTOFIT procedure leads to the conclusion that the best results were obtained with an ARIMA(0,1,5) model. I estimated the model over the full range of daily data from January 1, 2020 until the recent Friday, June 13, 2025. The fit is rather high and combining the forecasts of the linear model and for its residuals is very good.
My problem begun when I wanted to test how the fit of the model forecast for t+5 is, if the model starts using the data form the first available day until June 30, 2022 and re-estimate the parameters with ever new day until the end of the data sample. I used the following code.
If I run that code for the linear regression part only, it works well. However, if I un-comment the line with the BoxJenk instruction the programm executes only a few loops and then gets caught in an infinte loop. I can close Rats only via the windows task-manager. What did I made wrong with that code?
Thank you very much for help in advance.
Best regards
PeterF
I have developed a model to forecast the price development of Bitcoins. I have four lagged independent variables without a constant in a linear regression. However, the residuals are autorcorrelated. A test with BJAUTOFIT procedure leads to the conclusion that the best results were obtained with an ARIMA(0,1,5) model. I estimated the model over the full range of daily data from January 1, 2020 until the recent Friday, June 13, 2025. The fit is rather high and combining the forecasts of the linear model and for its residuals is very good.
My problem begun when I wanted to test how the fit of the model forecast for t+5 is, if the model starts using the data form the first available day until June 30, 2022 and re-estimate the parameters with ever new day until the end of the data sample. I used the following code.
Code: Select all
clear yhat5
do regend=2022:07:01, ende
comp number= regend-2022:07:01+1
linreg(noprint) BTC regstart regend btcresids
# Var1{5} Var2{5} Var3{5} Var4{5}
prj btc_est1 regstart+5 regend+5
disp number btc_est1(regend+5)
* BoxJenk(noprint,AR=0,Diff=1,MA=||1,2,5||,define=btc_forec1,Maxl) btcresids regstart+5 regend
* set resfit = %na
* set resfit = btcresids-%resids
* uforecast(equation=btc_forec1) resfit ende+1 ende+5
* set btc_for1 regstart+11 regend+5 = btc_est1+resfit
* set yhat5 regend regend = btc_For1(regend+5)
end doThank you very much for help in advance.
Best regards
PeterF