Nixtla / statsforecast

Lightning ⚡️ fast forecasting with statistical and econometric models.
https://nixtlaverse.nixtla.io/statsforecast
Apache License 2.0
3.96k stars 282 forks source link

Prediction Interval Questions #769

Closed webert6 closed 9 months ago

webert6 commented 9 months ago

Hello, I just want to make sure I am understanding correctly about how prediction intervals are used. I've been reading the documentation and code, but it's a bit difficult to comprehend without pulling apart the code executing it line by line.

Your feedback is much appreciated.

jmoralez commented 9 months ago

Hey @webert6, thanks for using statsforecast.

Please let us know if you have further doubts.

webert6 commented 9 months ago

Thank you for the quick reply @jmoralez. I just have a couple more questions as I'm still wrapping my head around conformal prediction.

jmoralez commented 9 months ago
webert6 commented 9 months ago

Regarding the first question, if the conformal prediction intervals differ if the specified model has a probabilistic output natively, I was watching this talk on conformal prediction and she mentioned combining probabilistic forecasting models with conformal prediction intervals can provide better prediction intervals than simply using conformal.

https://youtu.be/--WcrDRtrYk?si=Xc-cQRbgJ0ohoigN

Again, thank you for your help understanding.

jmoralez commented 9 months ago

If you want to you can define the same model twice with different settings and combine its intervals (the mean should be the same), e.g.

from statsforecast import StatsForecast
from statsforecast.models import AutoARIMA
from statsforecast.utils import AirPassengersDF, ConformalIntervals

sf = StatsForecast(
    models=[
        AutoARIMA(season_length=12, alias='native'),
        AutoARIMA(
            season_length=12,
            prediction_intervals=ConformalIntervals(n_windows=4, h=12),
            alias='conformal',
        ),
    ],
    freq='M',
)
sf.forecast(df=AirPassengersDF, h=12, level=[80])
webert6 commented 9 months ago

Great thanks! Really appreciate the responsiveness