Comments (6)
Hi @asinig. The StatsForecast
class is designed to be used only in forecasting, so it doesn't save anything related to training. However the implementation for the ARIMA
model saves its residuals, so you can access them if you use it directly. Here's an example:
from statsforecast.arima import auto_arima_f
from statsforecast.utils import AirPassengers
mod = auto_arima_f(AirPassengers, period=12)
mod['residuals'][:5]
# array([0.06466322, 0.03356584, 0.03380615, 0.02255185, 0.01075387])
Let us know if this helps.
from statsforecast.
Hi @asinig. Sorry, I agree we have to work on the documentation. What mod['arma']
returns is the same as defined here
arma
A compact form of the specification, as a vector giving the number of AR, MA, seasonal AR and seasonal MA coefficients, plus the period and the number of non-seasonal and seasonal differences.
So it is (p, q, P, Q, period, d, D)
. You may find the arima_string
function (which returns ARIMA(p, d, q)(P, D, Q)[period]
) useful as well:
from statsforecast.arima import arima_string, auto_arima_f
from statsforecast.utils import AirPassengers
mod = auto_arima_f(AirPassengers, period=12)
mod['arma']
# (1, 0, 0, 0, 12, 1, 1)
arima_string(mod)
# 'ARIMA(1,1,0)(0,1,0)[12]'
from statsforecast.
@all-contributors please add @asinig for idea
from statsforecast.
I've put up a pull request to add @asinig! 🎉
from statsforecast.
Hi @asinig. The
StatsForecast
class is designed to be used only in forecasting, so it doesn't save anything related to training. However the implementation for theARIMA
model saves its residuals, so you can access them if you use it directly. Here's an example:from statsforecast.arima import auto_arima_f from statsforecast.utils import AirPassengers mod = auto_arima_f(AirPassengers, period=12) mod['residuals'][:5] # array([0.06466322, 0.03356584, 0.03380615, 0.02255185, 0.01075387])Let us know if this helps.
@jmoralez Thank you for the example and I apologize for the delay in responding. I'm struggling a bit to fully understand how it works, since most of the library implementation is not commented. I saw that auto_arima
and auto_arima_f
do the same thing, and I was able to derive the residuals. What I can't figure out is that mod['arma']
returns the SARIMA model orders but I can't figure out in what order. In the example above mod['arma']
is a tuple, specifically (1, 0, 0, 12, 1, 1)
where
mod['coef']
= {'ar1': -0.30005076872006264},
so mod['arma']
returns a tuple representing the orders (p,d,q, ?, time horizon,?,?). I tried to figure out looking at the implementation in the arima.py
file (line 729), but I still don't understand what the ?
values represent, because in this case they can't be P,D,Q (the seasonal orders) otherwise I would have had the seasonal ma coefficient printed in mod['coef']
.
Let me know please, thank you again
from statsforecast.
Hi @asinig. Sorry, I agree we have to work on the documentation. What
mod['arma']
returns is the same as defined herearma
A compact form of the specification, as a vector giving the number of AR, MA, seasonal AR and seasonal MA coefficients, plus the period and the number of non-seasonal and seasonal differences.So it is
(p, q, P, Q, period, d, D)
. You may find thearima_string
function (which returnsARIMA(p, d, q)(P, D, Q)[period]
) useful as well:from statsforecast.arima import arima_string, auto_arima_f from statsforecast.utils import AirPassengers mod = auto_arima_f(AirPassengers, period=12) mod['arma'] # (1, 0, 0, 0, 12, 1, 1) arima_string(mod) # 'ARIMA(1,1,0)(0,1,0)[12]'
this is clearer, thank you! @jmoralez
from statsforecast.
Related Issues (20)
- Adding support for NPTS and Seasonal NPTS
- Adding bootstrapping functionnality from residuals of a model
- [Models] provide summary
- StatsForecast/AutoArima ZeroDivisionError HOT 2
- Prediction Interval Questions HOT 6
- Croston: Error fitting with 0.0 values HOT 1
- Make best fitted ARIMA an output of AutoARIMA HOT 2
- IMAPA Model not working in statsforecast=="1.7.2" HOT 1
- Allow external regressors TBATS HOT 2
- FutureWarning in AirPassengersDF
- can we reduce the prediction accuracy HOT 18
- [AutoETS] Access the model components (Error, Trend and Seasonality) HOT 1
- MSTL Plot HOT 2
- [AutoTBATS,TBATS] Usage example HOT 3
- AutoARIMA import error HOT 2
- Nixtla statsforecast/statsmodels failing to import polars HOT 3
- Independency of Time Series with Different Unique IDs HOT 2
- [Question] AutoARIMA.forward HOT 5
- Statsforecat.predict expects wrong dataframe shape on X_df HOT 10
- Add a check for fitting a theta model with less than two seasonal periods
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsforecast.