MixedLM.fit(start_params=None, reml=True, niter_em=0, niter_sa=0, do_cg=True, fe_pen=None, cov_pen=None, free=None, full_output=False, **kwargs)[source]

Fit a linear mixed model to the data.


start_params: array-like or MixedLMParams :

If a MixedLMParams the state provides the starting value. If array-like, this is the packed parameter vector, assumed to be in the same state as this model.

reml : bool

If true, fit according to the REML likelihood, else fit the standard likelihood using ML.

niter_sa : integer

The number of steepest ascent iterations

niter_em : non-negative integer

The number of EM steps. The EM steps always preceed steepest descent and conjugate gradient optimization. The EM algorithm implemented here is for ML estimation.

do_cg : bool

If True, a conjugate gradient algorithm is used for optimization (following any steepest descent or EM steps).

cov_pen : CovariancePenalty object

A penalty for the random effects covariance matrix

fe_pen : Penalty object

A penalty on the fixed effects

free : MixedLMParams object

If not None, this is a mask that allows parameters to be held fixed at specified values. A 1 indicates that the correspondinig parameter is estimated, a 0 indicates that it is fixed at its starting value. Setting the cov_re component to the identity matrix fits a model with independent random effects. The state of use_sqrt for free must agree with that of the parent model.

full_output : bool

If true, attach iteration history to results


A MixedLMResults instance. :


If start is provided as an array, it must have the same use_sqrt state as the parent model.

The value of free must have the same use_sqrt state as the parent model.

Previous topic


Next topic


This Page