statsmodels.tsa.statespace.mlemodel.MLEModel

class statsmodels.tsa.statespace.mlemodel.MLEModel(endog, k_states, exog=None, dates=None, freq=None, **kwargs)[source]

State space model for maximum likelihood estimation

Parameters:
  • endog (array_like) – The observed time-series process \(y\)
  • k_states (int) – The dimension of the unobserved state process.
  • exog (array_like, optional) – Array of exogenous regressors, shaped nobs x k. Default is no exogenous regressors.
  • dates (array-like of datetime, optional) – An array-like object of datetime objects. If a Pandas object is given for endog, it is assumed to have a DateIndex.
  • freq (str, optional) – The frequency of the time-series. A Pandas offset or ‘B’, ‘D’, ‘W’, ‘M’, ‘A’, or ‘Q’. This is optional if dates are given.
  • **kwargs – Keyword arguments may be used to provide default values for state space matrices or for Kalman filtering options. See Representation, and KalmanFilter for more details.
ssm

KalmanFilter – Underlying state space representation.

Notes

This class wraps the state space model with Kalman filtering to add in functionality for maximum likelihood estimation. In particular, it adds the concept of updating the state space representation based on a defined set of parameters, through the update method or updater attribute (see below for more details on which to use when), and it adds a fit method which uses a numerical optimizer to select the parameters that maximize the likelihood of the model.

The start_params update method must be overridden in the child class (and the transform and untransform methods, if needed).

Methods

filter(params[, transformed, complex_step, …]) Kalman filtering
fit([start_params, transformed, cov_type, …]) Fits the model by maximum likelihood via Kalman filter.
from_formula(formula, data[, subset]) Not implemented for state space models
hessian(params, *args, **kwargs) Hessian matrix of the likelihood function, evaluated at the given parameters
impulse_responses(params[, steps, impulse, …]) Impulse response function
information(params) Fisher information matrix of model
initialize() Initialize (possibly re-initialize) a Model instance.
initialize_approximate_diffuse([variance])
initialize_known(initial_state, …)
initialize_statespace(**kwargs) Initialize the state space representation
initialize_stationary()
loglike(params, *args, **kwargs) Loglikelihood evaluation
loglikeobs(params[, transformed, complex_step]) Loglikelihood evaluation
observed_information_matrix(params[, …]) Observed information matrix
opg_information_matrix(params[, …]) Outer product of gradients information matrix
predict(params[, exog]) After a model has been fit predict returns the fitted values.
prepare_data() Prepare data for use in the state space representation
score(params, *args, **kwargs) Compute the score function at params.
score_obs(params[, method, transformed, …]) Compute the score per observation, evaluated at params
set_conserve_memory([conserve_memory]) Set the memory conservation method
set_filter_method([filter_method]) Set the filtering method
set_inversion_method([inversion_method]) Set the inversion method
set_smoother_output([smoother_output]) Set the smoother output
set_stability_method([stability_method]) Set the numerical stability method
simulate(params, nsimulations[, …]) Simulate a new time series following the state space model
simulation_smoother([simulation_output]) Retrieve a simulation smoother for the state space model.
smooth(params[, transformed, complex_step, …]) Kalman smoothing
transform_jacobian(unconstrained[, …]) Jacobian matrix for the parameter transformation function
transform_params(unconstrained) Transform unconstrained parameters used by the optimizer to constrained parameters used in likelihood evaluation
untransform_params(constrained) Transform constrained parameters used in likelihood evaluation to unconstrained parameters used by the optimizer
update(params[, transformed, complex_step]) Update the parameters of the model

Attributes

endog_names Names of endogenous variables
exog_names
initial_variance
initialization
loglikelihood_burn
param_names (list of str) List of human readable parameter names (for parameters actually included in the model).
start_params (array) Starting parameters for maximum likelihood estimation.
tolerance