statsmodels.regression.mixed_linear_model.MixedLM.fit
-
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.
Parameters: 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 thecov_re
component to the identity matrix fits a model with independent random effects. The state ofuse_sqrt
forfree
must agree with that of the parent model.full_output : bool
If true, attach iteration history to results
Returns: A MixedLMResults instance. :
Notes
If
start
is provided as an array, it must have the sameuse_sqrt
state as the parent model.The value of
free
must have the sameuse_sqrt
state as the parent model.
Please login to continue.