class statsmodels.tsa.statespace.kalman_filter.KalmanFilter(k_endog, k_states, k_posdef=None, loglikelihood_burn=0, tolerance=1e-19, results_class=None, kalman_filter_classes=None, **kwargs)
[source]
State space representation of a time series process, with Kalman filter
Parameters: |
|
---|
There are several types of options available for controlling the Kalman filter operation. All options are internally held as bitmasks, but can be manipulated by setting class attributes, which act like boolean flags. For more information, see the set_*
class method documentation. The options are:
The filter_method
and inversion_method
options intentionally allow the possibility that multiple methods will be indicated. In the case that multiple methods are selected, the underlying Kalman filter will attempt to select the optional method given the input data.
For example, it may be that INVERT_UNIVARIATE and SOLVE_CHOLESKY are indicated (this is in fact the default case). In this case, if the endogenous vector is 1-dimensional (k_endog
= 1), then INVERT_UNIVARIATE is used and inversion reduces to simple division, and if it has a larger dimension, the Cholesky decomposition along with linear solving (rather than explicit matrix inversion) is used. If only SOLVE_CHOLESKY had been set, then the Cholesky decomposition method would always be used, even in the case of 1-dimensional data.
bind (endog) | Bind data to the statespace representation |
filter ([filter_method, inversion_method, …]) | Apply the Kalman filter to the statespace model. |
impulse_responses ([steps, impulse, …]) | Impulse response function |
initialize_approximate_diffuse ([variance]) | Initialize the statespace model with approximate diffuse values. |
initialize_known (initial_state, …) | Initialize the statespace model with known distribution for initial state. |
initialize_stationary () | Initialize the statespace model as stationary. |
loglike (**kwargs) | Calculate the loglikelihood associated with the statespace model. |
loglikeobs (**kwargs) | Calculate the loglikelihood for each observation associated with the statespace model. |
set_conserve_memory ([conserve_memory]) | Set the memory conservation method |
set_filter_method ([filter_method]) | Set the filtering method |
set_filter_timing ([alternate_timing]) | Set the filter timing convention |
set_inversion_method ([inversion_method]) | Set the inversion method |
set_stability_method ([stability_method]) | Set the numerical stability method |
simulate (nsimulations[, measurement_shocks, …]) | Simulate a new time series following the state space model |
conserve_memory | (int) Memory conservation bitmask. |
design | |
dtype | (dtype) Datatype of currently active representation matrices |
endog | |
filter_augmented | (bool) Flag for augmented Kalman filtering. |
filter_collapsed | (bool) Flag for Kalman filtering with collapsed observation vector. |
filter_conventional | (bool) Flag for conventional Kalman filtering. |
filter_exact_initial | (bool) Flag for exact initial Kalman filtering. |
filter_extended | (bool) Flag for extended Kalman filtering. |
filter_method | (int) Filtering method bitmask. |
filter_methods | |
filter_square_root | (bool) Flag for square-root Kalman filtering. |
filter_timing | (int) Filter timing. |
filter_univariate | (bool) Flag for univariate filtering of multivariate observation vector. |
filter_unscented | (bool) Flag for unscented Kalman filtering. |
inversion_method | (int) Inversion method bitmask. |
inversion_methods | |
invert_cholesky | (bool) Flag for Cholesky inversion method. |
invert_lu | (bool) Flag for LU inversion method. |
invert_univariate | (bool) Flag for univariate inversion method (recommended). |
memory_conserve | (bool) Flag to conserve the maximum amount of memory. |
memory_no_filtered | (bool) Flag to prevent storing filtered state and covariance matrices. |
memory_no_forecast | (bool) Flag to prevent storing forecasts. |
memory_no_gain | (bool) Flag to prevent storing the Kalman gain matrices. |
memory_no_likelihood | (bool) Flag to prevent storing likelihood values for each observation. |
memory_no_predicted | (bool) Flag to prevent storing predicted state and covariance matrices. |
memory_no_smoothing | (bool) Flag to prevent storing likelihood values for each observation. |
memory_no_std_forecast | (bool) Flag to prevent storing standardized forecast errors. |
memory_options | |
memory_store_all | (bool) Flag for storing all intermediate results in memory (default). |
obs | (array) Observation vector – \(y~(k\_endog \times nobs)\) |
obs_cov | |
obs_intercept | |
prefix | (str) BLAS prefix of currently active representation matrices |
selection | |
solve_cholesky | (bool) Flag for Cholesky and linear solver inversion method (recommended). |
solve_lu | (bool) Flag for LU and linear solver inversion method. |
stability_force_symmetry | (bool) Flag for enforcing covariance matrix symmetry |
stability_method | (int) Stability method bitmask. |
stability_methods | |
state_cov | |
state_intercept | |
time_invariant | (bool) Whether or not currently active representation matrices are time-invariant |
timing_init_filtered | (bool) Flag for the alternate timing convention (Kim and Nelson, 2012). |
timing_init_predicted | (bool) Flag for the default timing convention (Durbin and Koopman, 2012). |
timing_options | |
transition |
© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.tsa.statespace.kalman_filter.KalmanFilter.html