[R-sig-ME] question about linear mixed models
JOSE A ALEMAN
aleman at fordham.edu
Thu Jul 8 04:14:03 CEST 2010
Dear list users,
I have perhaps what may seem like a very simple question, given that I'm
new to R. I have been trying to fit a linear mixed effects model to a TSCS
dataset where I want to include random intercepts for country and year. I
have noticed that I get slightly different results depending on what
package I use (lme4 and nmle). I think this may have to do with the syntax
for specifying the random effects formula with nmle. With lme4, I type
something like this:
mixed.model <- lmer (y ~ x1+x2+x3 + (1 | nation) + (1 | year), data=data)
and R returns the following output for the random effects:
Random effects:
Groups Name Variance Std.Dev.
year (Intercept) 0.00 0.00
nation (Intercept) 9.40 3.07
Residual 2.42 1.56
With nmle, however, the formula would have to look something like this:
mixed.effects <- lme (y ~ x1+x2+x3, data=data,
random=~1|nation+1|year, method="REML")
The results, however, are different, and this leads me to suspect that I'm
not specifying the random effects formula correctly since R returns the
following formula:
Random effects:
Formula: ~1 | nation + 1 | year
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.9003 (Intr)
1 | nation + 1TRUE 0.9649 -0.918
Residual 2.0908
Why is this the case? Or am I missing something important?
Thank you,
Jose A. Aleman, Ph.D.
http://faculty.fordham.edu/aleman
More information about the R-sig-mixed-models
mailing list