6.6.2.2.2. statsmodels.sandbox.panel.mixed.OneWayMixed¶
-
class
statsmodels.sandbox.panel.mixed.
OneWayMixed
(units)[source]¶ Model for EM implementation of (repeated measures) mixed effects model.
‘Maximum Likelihood Computations with Repeated Measures: Application of the EM Algorithm’
Nan Laird; Nicholas Lange; Daniel Stram
Journal of the American Statistical Association, Vol. 82, No. 397. (Mar., 1987), pp. 97-105.
Parameters: units : list of units
the data for the individual units should be attached to the units
response, fixed and random : formula expression, called as argument to Formula
*available results and alias*
(subject to renaming, and coversion to cached attributes)
params() -> self.a : coefficient for fixed effects or exog
cov_params() -> self.Sinv : covariance estimate of fixed effects/exog
bse() : standard deviation of params
cov_random -> self.D : estimate of random effects covariance
params_random_units -> [self.units[...].b] : random coefficient for each unit
*attributes*
(others)
self.m : number of units
self.p : k_vars_fixed
self.q : k_vars_random
self.N : nobs (total)
Notes
Fit returns a result instance, but not all results that use the inherited methods have been checked.
Parameters need to change: drop formula and we require a naming convention for the units (currently Y,X,Z). - endog, exog_fe, endog_re ?
logL does not include constant, e.g. sqrt(pi) llf is for MLE not for REML
convergence criteria for iteration Currently convergence in the iterative solver is reached if either the loglikelihood or the fixed effects parameter don’t change above tolerance.
In some examples, the fixed effects parameters converged to 1e-5 within 150 iterations while the log likelihood did not converge within 2000 iterations. This might be the case if the fixed effects parameters are well estimated, but there are still changes in the random effects. If params_rtol and params_atol are set at a higher level, then the random effects might not be estimated to a very high precision.
The above was with a misspecified model, without a constant. With a correctly specified model convergence is fast, within a few iterations (6 in example).
6.6.2.2.2.1. Methods¶
__init__ (units) |
|
cont ([ML, rtol, params_rtol, params_atol]) |
convergence check for iterative estimation |
cov_fixed () |
Approximate covariance of estimates of fixed effects. |
cov_params () |
estimated covariance for coefficients for exogeneous variables or fixed effects |
cov_random () |
Estimate random effects covariance D. |
deviance ([ML]) |
deviance defined as 2 times the negative loglikelihood |
fit ([maxiter, ML, rtol, params_rtol, ...]) |
|
initialize () |
|
logL ([ML]) |
Return log-likelihood, REML by default. |
6.6.2.2.2.2. Attributes¶
bse |
standard errors of estimated coefficients for exogeneous variables (fixed) |
params |
estimated coefficients for exogeneous variables or fixed effects |
params_random_units |
random coefficients for each unit |