statsmodels.tsa.statespace.mlemodel.MLEModel.fit

MLEModel.fit(start_params=None, transformed=True, cov_type='opg', cov_kwds=None, method='lbfgs', maxiter=50, full_output=1, disp=5, callback=None, return_params=False, optim_hessian=None, **kwargs)[source]

Fits the model by maximum likelihood via Kalman filter.

Parameters:

start_params : array_like, optional

Initial guess of the solution for the loglikelihood maximization. If None, the default is given by Model.start_params.

transformed : boolean, optional

Whether or not start_params is already transformed. Default is True.

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.

cov_type : str, optional

The cov_type keyword governs the method for calculating the covariance matrix of parameter estimates. Can be one of:

  • ‘opg’ for the outer product of gradient estimator
  • ‘oim’ for the observed information matrix estimator, calculated using the method of Harvey (1989)
  • ‘cs’ for the observed information matrix estimator, calculated using a numerical (complex step) approximation of the Hessian matrix.
  • ‘delta’ for the observed information matrix estimator, calculated using a numerical (complex step) approximation of the Hessian along with the delta method (method of propagation of errors) applied to the parameter transformation function transform_params.
  • ‘robust’ for an approximate (quasi-maximum likelihood) covariance matrix that may be valid even in the presense of some misspecifications. Intermediate calculations use the ‘oim’ method.
  • ‘robust_cs’ is the same as ‘robust’ except that the intermediate calculations use the ‘cs’ method.

cov_kwds : dict or None, optional

See MLEResults.get_robustcov_results for a description required keywords for alternative covariance estimators

maxiter : int, optional

The maximum number of iterations to perform.

full_output : boolean, 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.

disp : boolean, 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_params : boolean, optional

Whether or not to return only the array of maximizing parameters. Default is False.

optim_hessian : {‘opg’,’oim’,’cs’}, optional

The method by which the Hessian is numerically approximated. ‘opg’ uses outer product of gradients, ‘oim’ uses the information matrix formula from Harvey (1989), and ‘cs’ uses second-order complex step differentiation. This keyword is only relevant if the optimization method uses the Hessian matrix.

**kwargs :

Additional keyword arguments to pass to the optimizer.

Returns:

MLEResults :