statsmodels.regression.recursive_ls.RecursiveLS

class statsmodels.regression.recursive_ls.RecursiveLS(endog, exog, constraints=None, **kwargs)[source]

Recursive least squares

Parameters
endogarray_like

The observed time-series process \(y\)

exogarray_like

Array of exogenous regressors, shaped nobs x k.

constraintsarray_like, str, or tuple
  • array : An r x k array where r is the number of restrictions to test and k is the number of regressors. It is assumed that the linear combination is equal to zero.

  • str : The full hypotheses to test can be given as a string. See the examples.

  • tuple : A tuple of arrays in the form (R, q), q can be either a scalar or a length p row vector.

Notes

Recursive least squares (RLS) corresponds to expanding window ordinary least squares (OLS).

This model applies the Kalman filter to compute recursive estimates of the coefficients and recursive residuals.

References

*

Durbin, James, and Siem Jan Koopman. 2012. Time Series Analysis by State Space Methods: Second Edition. Oxford University Press.

Attributes
endog_names

Names of endogenous variables.

exog_names

The names of the exogenous variables.

initial_variance
initialization
loglikelihood_burn
param_names

(list of str) List of human readable parameter names (for parameters

start_params

(array) Starting parameters for maximum likelihood estimation.

state_names

(list of str) List of human readable names for unobserved states.

tolerance

Methods

clone(endog[, exog])

Clone state space model with new data and optionally new specification

filter([return_ssm])

Kalman filtering

fit()

Fits the model by application of the Kalman filter

fit_constrained(constraints[, start_params])

Fit the model with some parameters subject to equality constraints.

fix_params(params)

Fix parameters to specific values (context manager)

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 approximate diffuse

initialize_known(initial_state, …)

Initialize known

initialize_statespace(**kwargs)

Initialize the state space representation

initialize_stationary()

Initialize stationary

loglike(params, *args, **kwargs)

Loglikelihood evaluation

loglikeobs(params[, transformed, …])

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([return_ssm])

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, **kwargs)

Update the parameters of the model

handle_params

Methods

clone(endog[, exog])

Clone state space model with new data and optionally new specification

filter([return_ssm])

Kalman filtering

fit()

Fits the model by application of the Kalman filter

fit_constrained(constraints[, start_params])

Fit the model with some parameters subject to equality constraints.

fix_params(params)

Fix parameters to specific values (context manager)

from_formula(formula, data[, subset, …])

Not implemented for state space models

handle_params(params[, transformed, …])

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 approximate diffuse

initialize_known(initial_state, …)

Initialize known

initialize_statespace(**kwargs)

Initialize the state space representation

initialize_stationary()

Initialize stationary

loglike(params, *args, **kwargs)

Loglikelihood evaluation

loglikeobs(params[, transformed, …])

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([return_ssm])

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, **kwargs)

Update the parameters of the model

Properties

endog_names

Names of endogenous variables.

exog_names

The names of the exogenous variables.

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.

state_names

(list of str) List of human readable names for unobserved states.

tolerance