--- title: ARIMA keywords: fastai sidebar: home_sidebar nb_path: "nbs/arima.ipynb" ---
{% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
arima(ap, order=(2, 1, 1), seasonal={'order': (0, 1, 0), 'period': 12}, 
      include_mean=False, method='CSS-ML')['coef']
{% endraw %} {% raw %}

predict_arima[source]

predict_arima(model, n_ahead, newxreg=None, se_fit=True)

{% endraw %} {% raw %}
{% endraw %} {% raw %}
predict_arima(res, 10)
{% endraw %} {% raw %}
predict_arima(res_intercept, 10)
{% endraw %} {% raw %}
newdrift = np.arange(ap.size + 1, ap.size + 10 + 1).reshape(-1, 1)
newxreg = np.concatenate([newdrift, np.sqrt(newdrift)], axis=1)
predict_arima(res_xreg, 10, newxreg=newxreg)
{% endraw %} {% raw %}
myarima(ap, order=(2, 1, 1), seasonal={'order': (0, 1, 0), 'period': 12}, 
        constant=False, ic='aicc', method='CSS-ML')['aic']
{% endraw %} {% raw %}

arima_string[source]

arima_string(model, padding=False)

{% endraw %} {% raw %}
{% endraw %} {% raw %}

forecast_arima[source]

forecast_arima(model, h=None, level=None, fan=False, xreg=None, blambda=None, bootstrap=False, npaths=5000, biasadj=None)

{% endraw %} {% raw %}
{% endraw %} {% raw %}

fitted_arima[source]

fitted_arima(model, h=1)

Returns h-step forecasts for the data used in fitting the model.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

auto_arima_f[source]

auto_arima_f(x, d=None, D=None, max_p=5, max_q=5, max_P=2, max_Q=2, max_order=5, max_d=2, max_D=1, start_p=2, start_q=2, start_P=1, start_Q=1, stationary=False, seasonal=True, ic='aicc', stepwise=True, nmodels=94, trace=False, approximation=None, method=None, truncate=None, xreg=None, test='kpss', test_kwargs=None, seasonal_test='seas', seasonal_test_kwargs=None, allowdrift=True, allowmean=True, blambda=None, biasadj=False, parallel=False, num_cores=2, period=1)

{% endraw %} {% raw %}
{% endraw %} {% raw %}

print_statsforecast_ARIMA(model, digits=3, se=True)

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class ARIMASummary[source]

ARIMASummary(model)

ARIMA Summary.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class AutoARIMA[source]

AutoARIMA(d:Optional[int]=None, D:Optional[int]=None, max_p:int=5, max_q:int=5, max_P:int=2, max_Q:int=2, max_order:int=5, max_d:int=2, max_D:int=1, start_p:int=2, start_q:int=2, start_P:int=1, start_Q:int=1, stationary:bool=False, seasonal:bool=True, ic:str='aicc', stepwise:bool=True, nmodels:int=94, trace:bool=False, approximation:Optional[bool]=None, method:Optional[str]=None, truncate:Optional[bool]=None, test:str='kpss', test_kwargs:Optional[str]=None, seasonal_test:str='seas', seasonal_test_kwargs:Optional[Dict[KT, VT]]=None, allowdrift:bool=True, allowmean:bool=True, blambda:Optional[float]=None, biasadj:bool=False, parallel:bool=False, num_cores:int=2, period:int=1)

An AutoARIMA estimator.

Returns best ARIMA model according to either AIC, AICc or BIC value. The function conducts a search over possible model within the order constraints provided.

Parameters

d: int optional (default None) Order of first-differencing. If missing, will choose a value based on test. D: int optional (default None) Order of seasonal-differencing. If missing, will choose a value based on season_test. max_p: int (default 5) Maximum value of p. max_q: int (default 5) Maximum value of q. max_P: int (default 2) Maximum value of P. max_Q: int (default 2) Maximum value of Q. max_order: int (default 5) Maximum value of p+q+P+Q if model selection is not stepwise. max_d: int (default 2) Maximum number of non-seasonal differences max_D: int (default 1) Maximum number of seasonal differences start_p: int (default 2) Starting value of p in stepwise procedure. start_q: int (default 2) Starting value of q in stepwise procedure. start_P: int (default 1) Starting value of P in stepwise procedure. start_Q: int (default 1) Starting value of Q in stepwise procedure. stationary: bool (default False) If True, restricts search to stationary models. seasonal: bool (default True) If False, restricts search to non-seasonal models. ic: str (default 'aicc') Information criterion to be used in model selection. stepwise: bool (default True) If True, will do stepwise selection (faster). Otherwise, it searches over all models. Non-stepwise selection can be very slow, especially for seasonal models. nmodels: int (default 94) Maximum number of models considered in the stepwise search. trace: bool (default False) If True, the list of ARIMA models considered will be reported. approximation: bool optional (default None) If True, estimation is via conditional sums of squares and the information criteria used for model selection are approximated. The final model is still computed using maximum likelihood estimation. Approximation should be used for long time series or a high seasonal period to avoid excessive computation times. method: str optional (default None) fitting method: maximum likelihood or minimize conditional sum-of-squares. The default (unless there are missing values) is to use conditional-sum-of-squares to find starting values, then maximum likelihood. Can be abbreviated. truncate: bool optional (default None) An integer value indicating how many observations to use in model selection. The last truncate values of the series are used to select a model when truncate is not None and approximation=True. All observations are used if either truncate=None or approximation=False. test: str (default 'kpss') Type of unit root test to use. See ndiffs for details. test_kwargs: str optional (default None) Additional arguments to be passed to the unit root test. seasonal_test: str (default 'seas') This determines which method is used to select the number of seasonal differences. The default method is to use a measure of seasonal strength computed from an STL decomposition. Other possibilities involve seasonal unit root tests. seasonal_test_kwargs: dict optional (default None) Additional arguments to be passed to the seasonal unit root test. See nsdiffs for details. allowdrift: bool (default True) If True, models with drift terms are considered. allowmean: bool (default True) If True, models with a non-zero mean are considered. blambda: float optional (default None) Box-Cox transformation parameter. If lambda="auto", then a transformation is automatically selected using BoxCox.lambda. The transformation is ignored if None. Otherwise, data transformed before model is estimated. biasadj: bool (default False) Use adjusted back-transformed mean for Box-Cox transformations. If transformed data is used to produce forecasts and fitted values, a regular back transformation will result in median forecasts. If biasadj is True, an adjustment will be made to produce mean forecasts and fitted values. parallel: bool (default False) If True and stepwise = False, then the specification search is done in parallel. This can give a significant speedup on multicore machines. num_cores: int (default 2) Allows the user to specify the amount of parallel processes to be used if parallel = True and stepwise = False. If None, then the number of logical cores is automatically detected and all available cores are used. period: int (default 1) Number of observations per unit of time. For example 24 for Hourly data.

Notes

  • This implementation is a mirror of Hyndman's forecast::auto.arima.

References

[1] https://github.com/robjhyndman/forecast

{% endraw %} {% raw %}
{% endraw %}