statsmodels.tsa.statespace.mlemodel.MLEResults.impulse_responses¶
- MLEResults.impulse_responses(steps=1, impulse=0, orthogonalized=False, cumulative=False, **kwargs)[source]¶
Impulse response function
- Parameters
- steps
int
,optional
The number of steps for which impulse responses are calculated. Default is 1. Note that for time-invariant models, the initial impulse is not counted as a step, so if steps=1, the output will have 2 entries.
- impulse
int
,str
or array_like If an integer, the state innovation to pulse; must be between 0 and k_posdef-1. If a str, it indicates which column of df the unit (1) impulse is given. Alternatively, a custom impulse vector may be provided; must be shaped k_posdef x 1.
- orthogonalizedbool,
optional
Whether or not to perform impulse using orthogonalized innovations. Note that this will also affect custum impulse vectors. Default is False.
- cumulativebool,
optional
Whether or not to return cumulative impulse responses. Default is False.
- anchor
int
,str
,or
datetime
,optional
Time point within the sample for the state innovation impulse. Type depends on the index of the given endog in the model. Two special cases are the strings ‘start’ and ‘end’, which refer to setting the impulse at the first and last points of the sample, respectively. Integer values can run from 0 to nobs - 1, or can be negative to apply negative indexing. Finally, if a date/time index was provided to the model, then this argument can be a date string to parse or a datetime type. Default is ‘start’.
- exogarray_like,
optional
New observations of exogenous regressors, if applicable.
- **kwargs
If the model has time-varying design or transition matrices and the combination of anchor and steps implies creating impulse responses for the out-of-sample period, then these matrices must have updated values provided for the out-of-sample steps. For example, if design is a time-varying component, nobs is 10, anchor=1, and steps is 15, a (k_endog x k_states x 7) matrix must be provided with the new design matrix values.
- steps
- Returns
- impulse_responses
ndarray
Responses for each endogenous variable due to the impulse given by the impulse argument. For a time-invariant model, the impulse responses are given for steps + 1 elements (this gives the “initial impulse” followed by steps responses for the important cases of VAR and SARIMAX models), while for time-varying models the impulse responses are only given for steps elements (to avoid having to unexpectedly provide updated time-varying matrices).
- impulse_responses
Notes
Intercepts in the measurement and state equation are ignored when calculating impulse responses.