DynamicFactorMQ.fit_em(start_params=None, transformed=True, cov_type='none', cov_kwds=None, maxiter=500, tolerance=1e-06, disp=False, em_initialization=True, mstep_method=None, full_output=True, return_params=False, low_memory=False, llf_decrease_action='revert', llf_decrease_tolerance=0.0001)[source]

Fits the model by maximum likelihood via the EM algorithm.

start_paramsarray_like, optional

Initial guess of the solution for the loglikelihood maximization. The default is to use DynamicFactorMQ.start_params.

transformedbool, optional

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

cov_typestr, 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)

  • ‘approx’ for the observed information matrix estimator, calculated using a numerical approximation of the Hessian matrix.

  • ‘robust’ for an approximate (quasi-maximum likelihood) covariance matrix that may be valid even in the presence of some misspecifications. Intermediate calculations use the ‘oim’ method.

  • ‘robust_approx’ is the same as ‘robust’ except that the intermediate calculations use the ‘approx’ method.

  • ‘none’ for no covariance matrix calculation.

Default is ‘none’, since computing this matrix can be very slow when there are a large number of parameters.

cov_kwdsdict or None, optional

A dictionary of arguments affecting covariance matrix computation.

opg, oim, approx, robust, robust_approx

  • ‘approx_complex_step’ : bool, optional - If True, numerical approximations are computed using complex-step methods. If False, numerical approximations are computed using finite difference methods. Default is True.

  • ‘approx_centered’ : bool, optional - If True, numerical approximations computed using finite difference methods use a centered approximation. Default is False.

maxiterint, optional

The maximum number of EM iterations to perform.

tolerancefloat, optional

Parameter governing convergence of the EM algorithm. The tolerance is the minimum relative increase in the likelihood for which convergence will be declared. A smaller value for the tolerance will typically yield more precise parameter estimates, but will typically require more EM iterations. Default is 1e-6.

dispint or bool, optional

Controls printing of EM iteration progress. If an integer, progress is printed at every disp iterations. A value of True is interpreted as the value of 1. Default is False (nothing will be printed).

em_initializationbool, optional

Whether or not to also update the Kalman filter initialization using the EM algorithm. Default is True.

mstep_method{None, ‘missing’, ‘nonmissing’}, optional

The EM algorithm maximization step. If there are no NaN values in the dataset, this can be set to “nonmissing” (which is slightly faster) or “missing”, otherwise it must be “missing”. Default is “nonmissing” if there are no NaN values or “missing” if there are.

full_outputbool, optional

Set to True to have all available output from EM iterations in the Results object’s mle_retvals attribute.

return_paramsbool, optional

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

low_memorybool, optional

This option cannot be used with the EM algorithm and will raise an error if set to True. Default is False.

llf_decrease_action{‘ignore’, ‘warn’, ‘revert’}, optional

Action to take if the log-likelihood decreases in an EM iteration. ‘ignore’ continues the iterations, ‘warn’ issues a warning but continues the iterations, while ‘revert’ ends the iterations and returns the result from the last good iteration. Default is ‘warn’.

llf_decrease_tolerancefloat, optional

Minimum size of the log-likelihood decrease required to trigger a warning or to end the EM iterations. Setting this value slightly larger than zero allows small decreases in the log-likelihood that may be caused by numerical issues. If set to zero, then any decrease will trigger the llf_decrease_action. Default is 1e-4.