#general

Title

s

Sean Nassimiha

06/21/2022, 2:02 PMHi everyone, I hope you are good!
I have a question about statsforecast auto_arima:
The documentation shows that we can execute auto_arima like this:

Copy code

```
fcst = StatsForecast(
series_train,
models=[(auto_arima, 12)],
freq='M',
n_jobs=1
)
```

But what if I want to restrict the search space of the AR, MA orders? How can I limit the order of (S)AR and (S)MA to, say, p=1, q=1, P=1, Q=1?
Thank you! (please let me know if I should be asking this in some other channel)ðŸ‘€ 1

m

Max (Nixtla)

06/21/2022, 2:14 PMThanks for your question. We will come back to you soon.

s

Sean Nassimiha

06/21/2022, 2:14 PMThank you **@Max (Nixtla)**!

Hello **@Max (Nixtla)**, do you have any updates on this? Thank you, and thank you for this amazing package!

m

Max (Nixtla)

06/22/2022, 2:36 PMs

Sean Nassimiha

06/22/2022, 3:09 PMHi, just as a follow up, I have found a quick way of doing this through the AutoARIMAProphet class! Thank you

f

fede (nixtla) (they/them)

06/22/2022, 3:21 PMHi **@Sean Nassimiha**! Thank you for using

`StatsForecast`

. For the moment, those parameters canâ€™t be modified (we are working on this). There is a workaround though: the `auto_arima`

function uses `auto_arima_f`

. So you can create your own `auto_arima`

function using:
Copy code

```
from statsforecast.arima import auto_arima_f, forecast_arima
def auto_arima(X: np.ndarray, h: int, future_xreg=None, season_length: int = 1,
approximation: bool = False, level: Optional[Tuple[int]] = None) -> np.ndarray:
y = X[:, 0] if X.ndim == 2 else X
xreg = X[:, 1:] if (X.ndim == 2 and X.shape[1] > 1) else None
mod = auto_arima_f(
y,
xreg=xreg,
period=season_length,
approximation=approximation,
allowmean=False, allowdrift=False, #not implemented yet
##EXTRA PARAMETERS HERE
max_p=1,
max_q=1
)
fcst = forecast_arima(mod, h, xreg=future_xreg, level=level)
if level is None:
return fcst['mean']
return {
'mean': fcst['mean'],
**{f'lo-{l}': fcst['lower'][f'{l}%'] for l in reversed(level)},
**{f'hi-{l}': fcst['upper'][f'{l}%'] for l in level},
}
```

Then, you can pass your `auto_arima`

to the `models`

argument.s

Sean Nassimiha

06/23/2022, 6:52 AMThank you **@fede**!

p

Pandula

06/23/2022, 1:25 PMhey, sorry for jumping on this thread. I was wondering if thereâ€™s a way to extract the p,q values picked by the model after fitting it? (using

`StatsForecast`

)