[R-sig-ME] Confusion specifiying random effect interactions

Stuart Luppescu slu at ccsr.uchicago.edu
Fri Jan 20 20:06:05 CET 2012


Hello, I'm interested in determining whether teachers are better at
teaching one subject than another. I have a data set of reading and math
value-added measures for students grouped by classroom. Here is a
portion of the dataset:

            vam grade  classroom Subject
9    0.246568321     4   2860A104    Math
10   0.282774796     4    3510108    Math
25   0.203518951     4   5180A111    Math
26   0.924048731     4   8000A201    Math
27   0.005249245     4   5140A213    Math
37   0.145352029     4   3430A205    Math
46   0.015531502     4   6100A202    Math
47   0.412358095     4   6370A111    Math
51   0.165086054     4   6950A103    Math
56   0.830843297     4   3040A200    Math
59   0.259168594     4   6610A202    Math
62   0.497570314     4   3360A203    Math
961  0.872717363     4   3240A207    Math


My aim is to get the within-classroom, between-subject correlation, and
the fixed effect for subject. I ran two models:

lme1 <- lmer(data=data.all,
     formula=vam ~ grade + Subject +  (Subject|classroom))
     
lme2 <- lmer(data=data.all,
     formula=vam ~ grade + Subject +  (0 + Subject|classroom))
     
lme1 gives these variance components:

Linear mixed model fit by REML 
Formula: vam ~ grade + Subject + (Subject | classroom) 
   Data: data.all 
   AIC   BIC logLik deviance REMLdev
 42844 42924 -21414    42787   42828
Random effects:
 Groups    Name        Variance  Std.Dev. Corr  
 classroom (Intercept) 0.0079163 0.088974       
           SubjectRead 0.0069161 0.083163 0.041 
 Residual              0.0721588 0.268624       
Number of obs: 161031, groups: classroom, 3786

If I'm interpreting this correctly, this gives the between-classroom
variance, and the between-subject variance, and the correlation between
the intercept and the subject effect. (The fixed effect for Subject is
insignificantly small.)

The second model gives this:
Linear mixed model fit by REML 
Formula: vam ~ grade + Subject + (0 + Subject | classroom) 
   Data: data.all 
   AIC   BIC logLik deviance REMLdev
 42844 42924 -21414    42787   42828
Random effects:
 Groups    Name        Variance  Std.Dev. Corr  
 classroom SubjectMath 0.0079163 0.088974       
           SubjectRead 0.0154327 0.124228 0.743 
 Residual              0.0721588 0.268624       
Number of obs: 161031, groups: classroom, 3786

This one gives the correlation between Reading and Math, but puts all
the between-classroom variance into the subject-classroom interaction.
I'm thinking that in order to make the correct inferences I should have
a combination of these two with a between-classroom variance component,
and a subject-by-classroom component, but I can't figure out how to do
it in one model. I would appreciate any help I can get.

-- 
Stuart Luppescu -=- slu .at. ccsr.uchicago.edu        
University of Chicago -=- CCSR 
才文と智奈美の父 -=-    Kernel 3.1.6-gentoo                
I'm always thrilled when people discover what
 lexical scoping really means.    -- Robert
 Gentleman       Statistical Computing 2003,
 Reisensburg (June 2003)




More information about the R-sig-mixed-models mailing list