[Python] How to include the constant/intercept when fitting SARIMA model in python

Discussão em 'Python' iniciado por Stack, Fevereiro 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have implemented an auto SARIMA model in python with the code:

    import pmdarima as pm

    smodel = pm.auto_arima(df, start_p=1, start_q=1,
    test='adf',
    max_p=3, max_q=3, m=12,
    start_P=0, seasonal=True,
    d=1, D=1, trace=True,
    error_action='ignore',
    suppress_warnings=True,
    stepwise=True)

    smodel.summary()


    The results show that the best model was with an intercept, as seen on the image. enter image description here But when I am trying to fit the best model (SARIMAX(0, 1, 2)x(2, 1, 0, 12)) with the code:

    from statsmodels.tsa.statespace.sarimax import SARIMAX

    model = SARIMAX(df, order=(0, 1, 2), seasonal_order=(2, 1, 0, 12))
    model_fit = model.fit(disp= False)
    print(model_fit.summary())


    I am obtaining a result without the Intercept, as seen on the image. enter image description here.

    I would like to know why the intercept no more appear, and how to include it.

    Thanks.

    Continue reading...

Compartilhe esta Página