Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I perform a likelihood ratio test on a linear mixed-effect model?

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?

like image 646
Louis Thibault Avatar asked May 30 '15 02:05

Louis Thibault


1 Answers

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.

like image 92
Kerby Shedden Avatar answered Oct 18 '22 23:10

Kerby Shedden