Skip to content

Instantly share code, notes, and snippets.

@ChadFulton
Last active September 21, 2023 23:42
Show Gist options
  • Save ChadFulton/82744b500a5dcb0283624c80fd10c92b to your computer and use it in GitHub Desktop.
Save ChadFulton/82744b500a5dcb0283624c80fd10c92b to your computer and use it in GitHub Desktop.
Statsmodels - ARIMA with exogenous regressors
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ChadFulton
Copy link
Author

It looks like you want to model a pulse to the intercept, which would imply a change to the mean that slowly dies out according to the dynamics from the lag polynomial. If so, this isn't immediately available with the SARIMAX class, because as I said above, it models exog as affecting the mean of the process.

You could create the intervention manually to be a pulse that dies out slowly, but the problem is that they you would have to specify that process, rather than letting it follow from the model dynamics.

Possibly a better way is to create a subclass that models exog as affecting the intercept rather than the mean (if this is in fact what you're looking for). In practice, this just means putting the beta * exog term into the state_intercept rather than the obs_intercept component of the state space system. However, this may be more work than you are wanting to do.

@JasperLS
Copy link

Okay, thanks a lot! I'll see what makes sense. Moving the beta*exog sounds possible at first glance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment