Dear list, I am fitting a logistic multi-level regression model and need to test the difference between the ordinary logistic regression from a glm() fit and the mixed effects fit from glmer(), basically I want to do a likelihood ratio test between the two fits.
The data are like this: My outcome is a (1,0) for health status, I have several (1,0) dummy variables RURAL, SMOKE, DRINK, EMPLOYED, highereduc, INDIG, male, divorced, SINGLE, chronic, vigor_d and moderat_d and AGE is continuous (20 to 100). My higher level is called munid and has 581 levels. The data have 45243 observations. Here are my program statements: #GLM fit ph.fit.2<-glm(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d,family=binomial(), data=mx.merge) #GLMER fit ph.fit.3<-glmer(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+INSURANCE+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d+(1|munid),family=binomial(), data=mx.merge) I cannot find a method in R that will do the LR test between a glm and a glmer fit, so I try to do it using the liklihoods from both models #form the likelihood ratio test between the glm and glmer fits x2<--2*(logLik(ph.fit.2)-logLik(ph.fit.3)) > ML 79.60454 attr(,"nobs") n 45243 attr(,"nall") n 45243 attr(,"df") [1] 14 attr(,"REML") [1] FALSE attr(,"class") [1] "logLik" #Get the associated p-value dchisq(x2,14) ML >5.94849e-15 Which looks like an improvement in model fit to me. Am I seeing this correctly or are the two models even able to be compared? they are both estimated via maximum likelihood, so they should be, I think. Any help would be appreciated. Corey Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio One UTSA Circle San Antonio, TX 78249 email:[EMAIL PROTECTED] web: https://rowdyspace.utsa.edu/users/ozd504/www/index.htm [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.