The documentation for Statsmodels' linear mixed-effect models claims that
The Statsmodels LME framework currently supports post-estimation inference via Wald tests and confidence intervals on the coefficients, profile likelihood analysis, likelihood ratio testing, and AIC. [emphasis added]
I've noted the MixedLM.loglike
method, but I can't seem to find a function/method for running a likelihood ratio test.
Could somebody kindly point me in the right direction?
I'm running a development branch so things may have changed, but the results class returned by MixedLM.fit() should have an attribute called 'llf'. That is the value of the log-likelihood function at the estimated parameters. If you have two nested models and take -2 times the difference in their llf values, under the null hypothesis where the simpler model is true, this will be a chi^2 random variable with degrees of freedom equal to the difference in degrees of freedom for the two models.
Note that many people feel that you should switch the estimator to ML (not the default REML) when using LR tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With