statsmodels.tsa.regime_switching.markov_regression.MarkovRegression.fit¶
-
MarkovRegression.
fit
(start_params=None, transformed=True, cov_type='approx', cov_kwds=None, method='bfgs', maxiter=100, full_output=1, disp=0, callback=None, return_params=False, em_iter=5, search_reps=0, search_iter=5, search_scale=1.0, **kwargs)¶ Fits the model by maximum likelihood via Hamilton filter.
- Parameters
- start_paramsarray_like,
optional
Initial guess of the solution for the loglikelihood maximization. If None, the default is given by Model.start_params.
- transformedbool,
optional
Whether or not start_params is already transformed. Default is True.
- cov_type
str
,optional
The type of covariance matrix estimator to use. Can be one of ‘approx’, ‘opg’, ‘robust’, or ‘none’. Default is ‘approx’.
- cov_kwds
dict
orNone
,optional
Keywords for alternative covariance estimators
- method
str
,optional
The method determines which solver from scipy.optimize is used, and it can be chosen from among the following strings:
‘newton’ for Newton-Raphson, ‘nm’ for Nelder-Mead
‘bfgs’ for Broyden-Fletcher-Goldfarb-Shanno (BFGS)
‘lbfgs’ for limited-memory BFGS with optional box constraints
‘powell’ for modified Powell’s method
‘cg’ for conjugate gradient
‘ncg’ for Newton-conjugate gradient
‘basinhopping’ for global basin-hopping solver
The explicit arguments in fit are passed to the solver, with the exception of the basin-hopping solver. Each solver has several optional arguments that are not the same across solvers. See the notes section below (or scipy.optimize) for the available arguments and for the list of explicit arguments that the basin-hopping solver supports.
- maxiter
int
,optional
The maximum number of iterations to perform.
- full_outputbool,
optional
Set to True to have all available output in the Results object’s mle_retvals attribute. The output is dependent on the solver. See LikelihoodModelResults notes section for more information.
- dispbool,
optional
Set to True to print convergence messages.
- callback
callable
callback
(xk
),optional
Called after each iteration, as callback(xk), where xk is the current parameter vector.
- return_paramsbool,
optional
Whether or not to return only the array of maximizing parameters. Default is False.
- em_iter
int
,optional
Number of initial EM iteration steps used to improve starting parameters.
- search_reps
int
,optional
Number of randomly drawn search parameters that are drawn around start_params to try and improve starting parameters. Default is 0.
- search_iter
int
,optional
Number of initial EM iteration steps used to improve each of the search parameter repetitions.
- search_scale
float
orarray
, optional. Scale of variates for random start parameter search.
- **kwargs
Additional keyword arguments to pass to the optimizer.
- start_paramsarray_like,
- Returns
MarkovSwitchingResults