[R-sig-ME] help with model specification for crossed random effects in lme4

Bertolt Meyer bmeyer at sozpsy.uzh.ch
Fri Aug 12 15:37:37 CEST 2011


Dear all,

I am struggeling with the correct specification of my first model with crossed random effects (at least I believe that that is what I need). I have read some of the previous posts on this list regarding crossed effects but none of those answered my question. As I am new to crossed effects, I apologize in advance for any blatant oversights. Any help on the following issue would be greatly appreciated:

I have a data set containing the individual work performance of workers at five measurement times, spaced one year apart. The workers worked in teams. I would like to predict the intercept and the slope of the performance over time with a group attribute, i.e., I would like to know whether the variance of team size explains some variance of workers' initial performance (at t1) and some of the slope variance of performance. 

Team membership changed between years, i.e., some workers were in team 1 in year 1 and in team 2 in year 2 and back in team 1 in year three. Accordingly, the team attributes such as team size can also change from year to year. Thus, workers are not nested in teams, but, as I understood it, teams and workers are partially crossed.

The data set looks like this (example data for first four workers):

> teamdata <- data.frame(worker = as.factor(c(rep(1,5),rep(2,5),rep(3,5),rep(4,5))), time = c(0:4,0:4,0:4,0:4), team = as.factor(c(1,1,2,1,3,1,1,1,5,5,2,2,2,2,2,3,3,1,1,2)), performance = c(73,71,75,109,85,64,71,88,79,91,67,70,82,81,94,62,65,80,77,90), teamsize = c(12,12,6,11,9, 12,12,11,5,5, 5,5,6,5,6, 9,9,9,9,9))

> teamdata

   worker time team performance teamsize
1       1    0    1          73       12
2       1    1    1          71       12
3       1    2    2          75        6
4       1    3    1         109       11
5       1    4    3          85        9
6       2    0    1          64       12
7       2    1    1          71       12
8       2    2    1          88       11
9       2    3    5          79        5
10      2    4    5          91        5
11      3    0    2          67        5
12      3    1    2          70        5
13      3    2    2          82        6
14      3    3    2          81        5
15      3    4    2          94        6
16      4    0    3          62        9
17      4    1    3          65        9
18      4    2    1          80        9
19      4    3    1          77        9
20      4    4    2          90        9

How do I specify the model correctly in lme4 in order to explain the intercept and variance of the time-performance slope through team size? I tried it this way (which runs on the example data with a iteration limit reached without convergence - warning):

library(lme4)
model.1 <- lmer(performance ~ 1 + teamsize * time + (1 + teamsize + time | worker) + (1 + teamsize + time | team), data = teamdata) 

Warning:
In mer_finalize(ans) : iteration limit reached without convergence (9)

> summary(model.1)
Linear mixed model fit by REML 
Formula: performance ~ 1 + teamsize * time + (1 + teamsize + time | worker) + (1 + teamsize + time | team) 
   Data: teamdata 
   AIC BIC logLik deviance REMLdev
 156.1 173 -61.03    129.4   122.1
Random effects:
 Groups   Name        Variance Std.Dev. Corr          
 worker   (Intercept) 170.7539 13.0673                
          teamsize      1.9917  1.4113  -1.000        
          time          3.8384  1.9592  -1.000  1.000 
 team     (Intercept) 414.1867 20.3516                
          teamsize      5.8190  2.4123  -1.000        
          time          6.1124  2.4723  -1.000  1.000 
 Residual              25.7302  5.0725                
Number of obs: 20, groups: worker, 4; team, 4

Fixed effects:
              Estimate Std. Error t value
(Intercept)    76.4410    15.9783   4.784
teamsize       -1.4331     1.7770  -0.806
time            0.7902     4.1254   0.192
teamsize:time   0.7536     0.4338   1.737

Correlation of Fixed Effects:
            (Intr) teamsz time  
teamsize    -0.982              
time        -0.769  0.700       
teamsize:tm  0.429 -0.373 -0.880

Is this the right way of doing it? And if yes, can someone provide me with a few pointers with regard to the interpretation of the different random effects?
Any help would be greatly appreciated.

Best regards,
Bertolt

-- 
Dr. Bertolt Meyer
Senior research and teaching associate
Social and Economic Psychology
Institute of Psychology, University of Zurich
Binzmuehlestrasse 14/13
CH-8050 Zurich
Switzerland

b.meyer at psychologie.uzh.ch
tel:   +41446357282
fax:   +41446357279




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