ImpulseResponseFunction
ImpulseResponseFunction
- class ImpulseResponseFunction(model=None, steps=1, impulse=0, orthogonalized=False, cumulative=False, anchor=None, transformed=True, includes_fixed=False)[source]
Calculation of Impulse Response Parameters for various time-series forecasters.
Direct interface to
statsmodels.tsa.statespace.[any_non_var_vecm_model].[MODEL_FROM_MODEL_MAPPING].impulse_responsesandstatsmodels.tsa.vector_ar.irf.IRAnalysis.Basically, an impulse reflects a simple input signal into a system. While system itself sounds very vague,in the context of time-series such a system can be simply a time series itself or a relationship between two time series. Especially in the context of time series, such a relationship is often assumed to be linear and dynamic and therefore to be found in in linear dynamic models such as VAR and VECM, but also in state-space models like Dynamic Factor (ignoring the fact we could write all time-series in statespace forms).
Going further, an impulse response traces how a one-time shock or sudden change of one time series variable within a system (of several time-series variables) unfolds over time in the whole system of all variables. Practical examples could be the shock/change in oil prices on gasoline prices, see for example: Chudik and Georgiadis 2019, “Estimation of impulse response functions when shocks are observed at a higher frequency than outcome variables.”, Working Paper No. 2307, European Central Bank.
The following
sktimeestimators support the calculation of an impulse response:DynamicFactorVARVARMAXVECM
- Parameters:
- modelAny
A previous fitted
sktimetime series forecaster fromsktime.forecasting. See above for the current supportedsktimemodels.- stepsint, optional, default=1
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.
- impulseint, str or array_like, optional, default=0
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, default=False
Whether or not to perform impulse using orthogonalized innovations. Note that this will also affect custom impulse vectors.
- cumulativebool, optional, default=False
Whether or not to return cumulative impulse responses.
- anchorint, str, or datetime, optional, default = #start#
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.
- transformedbool, optional, default=True
Whether or not params is already transformed.
- includes_fixedbool, optional, default=False
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.
- Attributes:
- irf_np.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). The output from the example may be read as follows: (i) Rows show the response variable or the variable affected. (ii) Columns show the impulse variable, the variable receiving the shock. The t=0, reflects the first dimension, so the immediate impact due to change of the impact variable. Impulse Response of statsmodels only shows the response for t=0 in this manner. So in the example variable 1 (X, column 0) receives in t=0 a shock it jumps by 1414 (row 0) and variable 2 (row 1) by -1.45.If variable 2 (X2, column 1) receives a shock in t=0 variable 1 jumps by 1401 and variable 2 by -1.45. When orthogonalized=True we speak of one std shock, when False of a one unit shock. This explanation holds true for alllinear multivariate time-series. If cumulative=True cumulates effects up to period t for all responses. If cumulative = False and forecast horizon is t=0, then the cumulative = False and True equals.
Notes
Parameter and Attribute description taken from statsmodels.Statsmodels has up to today two different interfaces for impulse responses. The first one is older and seems to serve only VAR, VECM and SVAR models. Within the IRAnalysis class is a plotting option showing directly the fade-out of the impulse response signal. Since an Impulse Response Function measures the change in a dynamic linear relationship, the concept of cointegration plays again a significant role again.
References
[1]Ballarin, G. 2025: Impulse Response Analysis of Structural Nonlinear
Time Series Models, https://arxiv.org/html/2305.19089v5
[2]Statsmodels (last visited 15/02/2026): https://www.statsmodels.org/stable/generated/statsmodels.tsa.statespace.varmax.VARMAX.impulse_responses.html
[3]Statsmodels (last visited 15/02/2026): https://www.statsmodels.org/stable/generated/statsmodels.tsa.statespace.dynamic_factor.DynamicFactor.impulse_responses.html
[4]Statsmodels (last visited 01/03/2026): https://www.statsmodels.org/stable/generated/statsmodels.tsa.vector_ar.irf.IRAnalysis.html
Examples
>>> from sktime.datasets import load_airline >>> from sktime.param_est.impulse import ImpulseResponseFunction >>> from sktime.forecasting.dynamic_factor import DynamicFactor as skdyn >>> import pandas as pd >>> X = load_airline() >>> X2 = X.shift(1).bfill() >>> df = pd.DataFrame({"X":X, "X2": X2}) >>> fitted_model = skdyn(k_factors=1, factor_order=2).fit(df) >>> sktime_irf = ImpulseResponseFunction(fitted_model, orthogonalized=True) >>> sktime_irf.fit(df) ImpulseResponseFunction(...) >>> print(sktime_irf.get_fitted_params()["irf"]) [[1414.75907225 1401.6016836 ] [ -1.45858745 -1.44502246]]
Methods
check_is_fitted([method_name])Check if the estimator has been fitted.
clone()Obtain a clone of the object with same hyper-parameters and config.
clone_tags(estimator[, tag_names])Clone tags from another object as dynamic override.
create_test_instance([parameter_set])Construct an instance of the class, using first test parameter set.
create_test_instances_and_names([parameter_set])Create list of all test instances and a list of names for them.
fit(X[, y])Fit estimator and estimate parameters.
get_class_tag(tag_name[, tag_value_default])Get class tag value from class, with tag level inheritance from parents.
get_class_tags()Get class tags from class, with tag level inheritance from parent classes.
get_config()Get config flags for self.
get_fitted_params([deep])Get fitted parameters.
get_param_defaults()Get object's parameter defaults.
get_param_names([sort])Get object's parameter names.
get_params([deep])Get a dict of parameters values for this object.
get_tag(tag_name[, tag_value_default, ...])Get tag value from instance, with tag level inheritance and overrides.
get_tags()Get tags from instance, with tag level inheritance and overrides.
get_test_params([parameter_set])Return testing parameter settings for the estimator/test.
is_composite()Check if the object is composed of other BaseObjects.
load_from_path(serial)Load object from file location.
load_from_serial(serial)Load object from serialized memory container.
reset()Reset the object to a clean post-init state.
save([path, serialization_format])Save serialized self to bytes-like object or to (.zip) file.
set_config(**config_dict)Set config flags to given values.
set_params(**params)Set the parameters of this object.
set_random_state([random_state, deep, ...])Set random_state pseudo-random seed parameters for self.
set_tags(**tag_dict)Set instance level tag overrides to given values.
update(X[, y])Update fitted parameters on more data.

