I have daily measurements of a variable X
in my timeseries. I was using two observations (D
and D-1
) to make forecast of a single day ahead (D+1
). After plotting ACF, i got the following:
We can see that would be better to use D-7
and D-14
, wich have higher correlation than D
and D-1
(wich make sense to me. For example, let's say D
is a monday, then D-7
represent the mondey a week earlier and D-14
represent a monday two weeks earlier). So, i used them as input in my model, but i actually got worse results in my forecast than i had when i was using D
and D-1
.
Besides using two days observation as input to my model, i also feed it with an one-hot-encode information of the day i wish to forecast. So, if i wish to forecast a monday, i would have an input similar to this:
X(D-14)| X(D-7)| Mon | Tue | Wed | Thur | Fri | Sat | Sun
10 | 20 | 1 | 0 | 0 | 0 | 0 | 0 | 0
And for a Tuesday, would be something like this:
X(D-14)| X(D-7)| Mon | Tue | Wed | Thur | Fri | Sat | Sun
50 | 30 | 0 | 1 | 0 | 0 | 0 | 0 | 0
So, does higher autocorrelated lagged values of a timeseries should always improve a model performance? If that's true, any ideas why my model actually got worse performance when making forecasts?
EDIT: My timeseries range from Jan/2017 until July/2022. For training, i am using the data from Jan/2017 until Dec/2021 (the last 20% of these data is used as validation set). So, for test, i'm using all months from Jan/2022 until July/2022. Iam using MAPE to assess my results. This MAPE is calculated per month. For example, i got these results when using D
and D-1
:
And, when using D-7
and D-14
i got these results:
Here is my timeseries plot, with the trend, seasonal and residual effect.
Just one more info, i am normalizing my timeseries between 0 and 1 (MinMaxScaler
from Sklearn) before feeding it to train/test my model.
seasonal_decompose
from thestatsmodel
Python module. I just did the following:decomp = seasonal_decompose(df['Load'], period=round(len(df) / 2), extrapolate_trend='freq')
and thentendencia = decomp.trend
,sazonal = decomp.seasonal
,residual = decomp.resid
. $\endgroup$