-
-
Save ChadFulton/82744b500a5dcb0283624c80fd10c92b to your computer and use it in GitHub Desktop.
Hi Chad, so sorry for reaching out again. I have also asked on StackOverflow: https://stackoverflow.com/questions/64013032/sarimax-pulse-intervention-effect-in-python. I feel like I am stupid or hitting a wall..
Let's say I have data for 5 time stamps, and at time step 3 there is an intervention.
If I want to model the intervention as a permanent shift of the mean, exog would be [0,0,1,0,0].
But if I want to model the intervention as a pulsed effect, that is declining again, would I need to change exog to something like [0,0,1,-1,0] ?
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.
Okay, thanks a lot! I'll see what makes sense. Moving the beta*exog
sounds possible at first glance.
The
SARIMAX
model is of the form "regression with SARIMA errors", so the intervention will be to the mean of the process. You're right, the one constructed here is a permanent increase in the mean.I'm not quite sure what your second question is regarding. You can certainly include a pulse intervention variable in
exog
also, and runningfit
will estimate a coefficient