-
Notifications
You must be signed in to change notification settings - Fork 26
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
Help with some pathological forecasts #201
Comments
Your intuitions are correct for the most part, but
is not really true. The seasonality can be a major part of the series, and in fact should be in this case. There are two separate issues here:
The answers are 1) no and 2) yes. The forecast is perfectly reasonable if you look at the state estimates because the estimated seasonality is extremely small. Since there is no seasonality and the trend is going upwards in the last in-sample observations, it's expected that the forecast will have a similar upwards trend. The problem here is that the seasonality wasn't estimated as we would expect (you can see its values range from -3 to 2 as opposed to the series which is in the order of hundreds). As a result, the majority of the real, unobserved seasonal component ended up in the trend. Some possible explanations for this issue, off the top of my head, are:
|
Thank you @raphaelsaavedra , that is what I wanted to double check. Yesterday, I've performed experiments with monthly series and they were more well-behaved. It is good to know that my intuition is aligned with yours. Is there a way to spot this problem automatically? Perhaps comparing the magnitude of the trend and seasonal components as you suggested could help as a rule of thumb? |
Perhaps using some different initialisation of filter method could also help? I am assuming that the default options of the model are a reasonable choice for users interested in robustness. |
It's good to keep in mind that
The square-root filter is more numerically stable, so you could try to use it (just use the kwarg |
My intuition is that this should not be modeled as a basic structural (trend + seasonality) model, the model should contain cycle components (trend + seasonality + cycle) that are not implemented on this version. |
@guilhermebodin can you elaborate on the conceptual difference between seasonal and cycle components? I was scanning the section of the book on this matter, but didn't have enough time read it carefully. |
Durbin and Koopman suggest that when a seasonal period is too long (365 days or 52 weeks in your case) you can model these seasonalities as cycles (that only have 2 states). |
Thanks for sharing. It seems that cycles are the way to go here indeed. :) |
Template added in #204. We still need to write an example. |
I've been playing with some forecasts of temperature at a few locations in the globe, and have noticed that sometimes the forecasts go off the historical data. Do you know if there is any way to enforce the seasonality and avoid this behaviour, which has never been seen?
For example, consider the time series I saved in this gist, and the script below:
The components of the model look like this:
Can you double check my intuition about these components? As I understand it, the
trend
component accounts for the mean or "general" behaviour of the process, when we exclude all the oscillations and disturbances. Given that this is a time series of temperature, I am understanding that this is the component that tells us which years where hotter and which years were colder overall. Theslope
component accounts for deviations from this general behaviour, which aren't explained by a fixed period of oscillation. So these would be related to external factors that one could research further. Finally, theseasonal
component accounts for an oscillation of fixed period that is not very interesting per see, but is there as part of the process. Do you feel that this is a good intuition?When I plot the forecast, I get this:
The forecast goes up indefinitely, even though the time series is known to oscillate within some physical bounds. Is there a way to circumvent this? It seems to agree with what the state space model learned about the components. The
trend
component in the previous plot seems to increase at the end of the series in way that fools the model. I've tried with other times of the year, and sometimes the forecasts also goes down indefinitely.I will keep investigating the issue. I've seen a section in the documentation about diagnosis, and would be happy to check for convergence if possible, or have some error estimates to guide me on when we can trust the forecasts.
The text was updated successfully, but these errors were encountered: