Closed FA5I closed 3 years ago
There is a better way.
One thing I don't understand is: what are you using AutoReg when you are trying to predict price using other variables? This doesn't sound like an autoregression, but a cross-sectional regression (also technically an ARDL).
Going to close as answered since no follow-up.
Thanks @bashtage ,
Apologies I seem to have missed the original notification in my mailbox and just saw the one today.
I think the answer makes sense - thanks for clearing that up!
Hi all,
I have just started using this library (and absolutely love it!). I am trying to backtest an AutoRegession model on some time series data. Now as an example (I realise stock prediction this way is a dumb idea, but the data is easy to get and share with you), I am using the data from here:
https://finance.yahoo.com/quote/%5EGSPC/history/
Initially I have the open, high, low, close and volume columns. I create a new column, y, by shifting close back 1 period. The reason is I want to use the other columns to predict the price in the next period.
The data looks as follows after this stage:
Now, I want to step through the historical data for n-periods, and see how well the model makes a forecast for the next period. To this end I wrote the following piece of code.
data
is the data frame in the image above:Now I have a couple of questions:
I read through the docs, but did not understand some things (maybe I'm just slow), namely:
len(x_train)
. Is this the right way to get the forecast out of sample, and does my forecast line up with the value in the test period? I am worried about future data leaking backwards.Any guidance is much appreciated!
P.S. I asked on SE but did not get a response directly to my question.