Skip to content
Prev 2817 / 20628 Next

How to define the fixed and random effects in lmer

FMH
Thank you for your advice, but actually i'm looking for the scripts via lmer function?in lme4 package.

Cheers
Fir



----- Original Message ----
From: "Bolker,Benjamin Michael" <bolker at ufl.edu>
To: FMH <kagba2006 at yahoo.com>; "r-sig-mixed-models at r-project.org" <r-sig-mixed-models at r-project.org>
Sent: Tuesday, September 15, 2009 1:48:54 PM
Subject: RE: [R-sig-ME] How to define the fixed and random effects in lmer


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)