statsmodels.tsa.statespace.structural.UnobservedComponents.impulse_responses¶
-
UnobservedComponents.impulse_responses(params, steps=
1
, impulse=0
, orthogonalized=False
, cumulative=False
, anchor=None
, exog=None
, extend_model=None
, extend_kwargs=None
, transformed=True
, includes_fixed=False
, **kwargs)¶ Impulse response function
- Parameters:¶
- paramsarray_like
Array of model 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 for our-of-sample periods, if applicable.
- transformedbool,
optional
Whether or not params is already transformed. Default is True.
- includes_fixedbool,
optional
If parameters were previously fixed with the fix_params method, this argument describes whether or not params also includes the fixed parameters, in addition to the free parameters. Default is False.
- **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.
- 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
See also
simulate
Simulate a time series according to the given state space model, optionally with specified series for the innovations.
Notes
Intercepts in the measurement and state equation are ignored when calculating impulse responses.
- TODO: add an option to allow changing the ordering for the
orthogonalized option. Will require permuting matrices when constructing the extended model.