facebook / prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
https://facebook.github.io/prophet
MIT License
18.26k stars 4.51k forks source link

Is there any function option to take care of autocorrelation of the residuals? #1622

Closed daydreamersjp closed 4 years ago

daydreamersjp commented 4 years ago

Hi there! I am new to the Prophet and already start loving this. I read through the HTML doc and the PeerJ Preprint paper along with some play-around of the API on Python. As far as I understand, the Prophet does not care about the autocorrelation in the residuals, and when I tested on the Peyton Manning data, the residual had ACF being exponentially decaying and PACF being high rise at lag=1 with close to zero at lag >=2, which implied the residual followed AR(1). Is there any function option to run on autocorrelated data, or do you expect to have any in the future, or was there any discussion already that we do not have to worry?

bletham commented 4 years ago

This seems like a useful analysis, thanks for bringing this up. There isn't any functionality around autocorrelation analysis. As to whether or not I'd worry about seeing autocorrelation in the residuals - if there is any periodic autocorrelation then that would suggest there is a missing seasonal effect. That knowledge (and the period extracted from the autocorrelation function) could be used to add a new seasonality. In this case where it is exponentially decaying, I'd probably expect that in most forecasts. The Prophet trend model is piecewise linear. There are probably more fine-grained trend fluctuations than that, which would be getting picked up by the noise component of the model.

From a practical point of view I suppose one could use this knowledge to fine-tune the forecast slightly by using yesterday's residual to bias today's forecast. But whether or not it's worth it would probably depend on how much autocorrelation there is, how quickly it decays, and how much you care about forecasting at that time range vs. longer.

xinnyuann commented 1 year ago

Totally agree. As an extensive Prophet user, I also find having residual analysis functionalities would be extremely helpful, so that hybrid models maybe be identified and developed. For example, I'm trying to apply Breusch-Godfrey Lagrange Multiplier tests from statsmodels to the output of Prophet to see if there's autocorrelations in residual because currently the sub-daily forecasting is below expectation. Do you have any suggestions or if this is the right direction to go?