I would recommend sending inquiries like this to the R-SIG-Mixed-Models at R-project.org mailing list, which I have taken the liberty of cc:'ing on this reply. I am not always able to give a rapid response to questions about mixed models in R.
On Wed, Mar 31, 2010 at 12:09 PM, Vivek Ayer <vivek.ayer at gmail.com> wrote:
Hi Doug, I'm quite interested in your lmer function in the lme4 package and had a question on how it worked vs. lm(). This is the command I run in R to get the desired mixed effect result: fitlmmixed <- lmer(MeasuredPathLoss ~ (1 | SiteLabel) + LogDist + Diffraction) Here's what I'd run to get the purley fixed effect result: fitlmfixed <- lm(MeasuredPathLoss ~ -1 + factor(SiteLabel) + LogDist + Diffraction) lm and lmer have interesting applications in the field of radio propagation and I just wanted to know how the parameters are treated. When I run summary on the former, it says the degrees of freedom are just LogDist, Diffraction, (1 | SiteLabel), the group intercept and sigma = 5. When I run summary on the latter, it says the degrees of freedom are LogDist, Diffraction, Sigma, and one deg of freedom for each factor. So clearly, in all cases, a pure fixed effects model will have more degrees of freedom than a mixed effects model and thus a better a logLik, but now by much. However, the advantage of fixed effects goes away when your group has many factors. So with those parameters I have above, the mixed model will always have 5 degs of freedom, while the fixed model can have no limit. Of course, this means the fixed effects model will allocate much more memory to the point where a machine may run out of memory, but this doesn't occur in lmer(). Why is that? Also, lmer is run fairly quickly, while producing very close results to lm's fixed effect. In lmer, is there really deg of freedom for each random effect, but all those degrees are bunched up into one effect, greatly reducing the number of parameters? Thanks, Vivek Ayer