statsmodels.tsa.statespace.kalman_filter.KalmanFilter.set_filter_method

KalmanFilter.set_filter_method(filter_method=None, **kwargs)[source]

Set the filtering method

The filtering method controls aspects of which Kalman filtering approach will be used.

Parameters:
filter_methodint, optional

Bitmask value to set the filter method to. See notes for details.

**kwargs

Keyword arguments may be used to influence the filter method by setting individual boolean flags. See notes for details.

Notes

The filtering method is defined by a collection of boolean flags, and is internally stored as a bitmask. The methods available are:

FILTER_CONVENTIONAL

Conventional Kalman filter.

FILTER_UNIVARIATE

Univariate approach to Kalman filtering. Overrides conventional method if both are specified.

FILTER_COLLAPSED

Collapsed approach to Kalman filtering. Will be used in addition to conventional or univariate filtering.

FILTER_CONCENTRATED

Use the concentrated log-likelihood function. Will be used in addition to the other options.

Note that only the first method is available if using a Scipy version older than 0.16.

If the bitmask is set directly via the filter_method argument, then the full method must be provided.

If keyword arguments are used to set individual boolean flags, then the lowercase of the method must be used as an argument name, and the value is the desired value of the boolean flag (True or False).

Note that the filter method may also be specified by directly modifying the class attributes which are defined similarly to the keyword arguments.

The default filtering method is FILTER_CONVENTIONAL.

Examples

>>> mod = sm.tsa.statespace.SARIMAX(range(10))
>>> mod.ssm.filter_method
1
>>> mod.ssm.filter_conventional
True
>>> mod.ssm.filter_univariate = True
>>> mod.ssm.filter_method
17
>>> mod.ssm.set_filter_method(filter_univariate=False,
...                           filter_collapsed=True)
>>> mod.ssm.filter_method
33
>>> mod.ssm.set_filter_method(filter_method=1)
>>> mod.ssm.filter_conventional
True
>>> mod.ssm.filter_univariate
False
>>> mod.ssm.filter_collapsed
False
>>> mod.ssm.filter_univariate = True
>>> mod.ssm.filter_method
17

Last update: Oct 03, 2024