[R] question about cumulating random effects in lmer

Dieter Menne dieter.menne at menne-biomed.de
Mon Apr 24 08:17:25 CEST 2006

zhongmiao wang <zhongmiao <at> gmail.com> writes:

> I am studying the effect of schools on student achievement growth over
> time. School effect is random. The effects of schools in prior years
> are assumed to be persistent till the current year. Thus, the total
> school effect in the second year is like J=J2+J1. Does anyone know how
> to model this kind of cumulating random effects in lmer? Thanks in
> advance!

Compute new variables with the cumulative effect of the previous years and use 
these instead of J2, J1. If there are not too many years, using "reshape" to 
make a "wide" version of the data frame, and then adding up within a row is 
probably the most transparent way to do this.


More information about the R-help mailing list