Markov switching regression model
Parameters: | endog : array_like
k_regimes : integer
order : integer
trend : {‘nc’, ‘c’, ‘t’, ‘ct’}
exog : array_like, optional
exog_tvtp : array_like, optional
switching_ar : boolean or iterable, optional
switching_trend : boolean or iterable, optional
switching_exog : boolean or iterable, optional
switching_variance : boolean, optional
|
---|
Notes
This model is new and API stability is not guaranteed, although changes will be made in a backwards compatible way if possible.
The model can be written as:
y_t = a_{S_t} + x_t' \beta_{S_t} + \phi_{1, S_t} (y_{t-1} - a_{S_{t-1}} - x_{t-1}' \beta_{S_{t-1}}) + \dots + \phi_{p, S_t} (y_{t-p} - a_{S_{t-p}} - x_{t-p}' \beta_{S_{t-p}}) + \varepsilon_t \\ \varepsilon_t \sim N(0, \sigma_{S_t}^2)
i.e. the model is an autoregression with where the autoregressive coefficients, the mean of the process (possibly including trend or regression effects) and the variance of the error term may be switching across regimes.
The trend is accomodated by prepending columns to the exog array. Thus if trend=’c’, the passed exog array should not already have a column of ones.
References
Kim, Chang-Jin, and Charles R. Nelson. 1999. “State-Space Models with Regime Switching: Classical and Gibbs-Sampling Approaches with Applications”. MIT Press Books. The MIT Press.
Methods
filter(*args, **kwargs) | Apply the Hamilton filter |
fit([start_params, transformed, cov_type, ...]) | Fits the model by maximum likelihood via Hamilton filter. |
from_formula(formula, data[, subset, drop_cols]) | Create a Model from a formula and dataframe. |
hessian(params[, transformed]) | Hessian matrix of the likelihood function, evaluated at the given |
information(params) | Fisher information matrix of model |
initial_probabilities(params[, ...]) | Retrieve initial probabilities |
initialize() | Initialize (possibly re-initialize) a Model instance. |
initialize_known(probabilities[, tol]) | Set initialization of regime probabilities to use known values |
initialize_steady_state() | Set initialization of regime probabilities to be steady-state values |
loglike(params[, transformed]) | Loglikelihood evaluation |
loglikeobs(params[, transformed]) | Loglikelihood evaluation for each period |
predict(params[, start, end, probabilities, ...]) | In-sample prediction and out-of-sample forecasting |
predict_conditional(params) | In-sample prediction, conditional on the current and previous regime |
regime_transition_matrix(params[, exog_tvtp]) | Construct the left-stochastic transition matrix |
score(params[, transformed]) | Compute the score function at params. |
score_obs(params[, transformed]) | Compute the score per observation, evaluated at params |
smooth(*args, **kwargs) | Apply the Kim smoother and Hamilton filter |
transform_params(unconstrained) | Transform unconstrained parameters used by the optimizer to constrained |
untransform_params(constrained) | Transform constrained parameters used in likelihood evaluation |
Methods
filter(*args, **kwargs) | Apply the Hamilton filter |
fit([start_params, transformed, cov_type, ...]) | Fits the model by maximum likelihood via Hamilton filter. |
from_formula(formula, data[, subset, drop_cols]) | Create a Model from a formula and dataframe. |
hessian(params[, transformed]) | Hessian matrix of the likelihood function, evaluated at the given |
information(params) | Fisher information matrix of model |
initial_probabilities(params[, ...]) | Retrieve initial probabilities |
initialize() | Initialize (possibly re-initialize) a Model instance. |
initialize_known(probabilities[, tol]) | Set initialization of regime probabilities to use known values |
initialize_steady_state() | Set initialization of regime probabilities to be steady-state values |
loglike(params[, transformed]) | Loglikelihood evaluation |
loglikeobs(params[, transformed]) | Loglikelihood evaluation for each period |
predict(params[, start, end, probabilities, ...]) | In-sample prediction and out-of-sample forecasting |
predict_conditional(params) | In-sample prediction, conditional on the current and previous regime |
regime_transition_matrix(params[, exog_tvtp]) | Construct the left-stochastic transition matrix |
score(params[, transformed]) | Compute the score function at params. |
score_obs(params[, transformed]) | Compute the score per observation, evaluated at params |
smooth(*args, **kwargs) | Apply the Kim smoother and Hamilton filter |
transform_params(unconstrained) | Transform unconstrained parameters used by the optimizer to constrained |
untransform_params(constrained) | Transform constrained parameters used in likelihood evaluation |
Attributes
endog_names | Names of endogenous variables |
exog_names | |
k_params | (int) Number of parameters in the model |
param_names | (list of str) List of human readable parameter names (for parameters |
start_params | (array) Starting parameters for maximum likelihood estimation. |