[R-sig-ME] How to define the fixed and random effects in lmer

Bolker,Benjamin Michael bolker at ufl.edu
Tue Sep 15 14:48:54 CEST 2009


I was running lme function on my data as shown below, in which the variables involved are:

########################################
#Pre : Precipitation
#t : time
#group : Group of precipitation
#prec: data set

lme(Pre ~ t| group, data = prec, random = ~ t| group)
#########################################

  I'm surprised this works (does it?) -- I didn't think |group was meaningful in a fixed-effects formula
specification

How could i write the scripts with lmer function with :
1. fixed effects for the intercept and slope and only random effect for the intercept is included

     lme(Pre~t, random=~1|group, data= prec)

2. fixed effects for the intercept and slope, and random effects for the intercept and slope are included


     lme(Pre~t, random=~t|group, data= prec)

3. only fixed effect for the intercept and only random effect for the intercept is included

     lme(Pre~1, random=~1|group, data= prec)

4. only fixed effects for the slope, and random effects for the intercept and slope are included

  lme(Pre~t-1, random=~1|group, data= prec)


  (I think. See if those work as expected)



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