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

FMH kagba2006 at yahoo.com
Wed Sep 16 14:59:40 CEST 2009


Thank you for the answer. How about a model with:

1. only fixed and random effects for the slope are included?


Cheers
Fir

 


----- Original Message ----
From: Luca Borger <lborger at uoguelph.ca>
To: FMH <kagba2006 at yahoo.com>
Cc: Benjamin Michael Bolker <bolker at ufl.edu>; r-sig-mixed-models at r-project.org
Sent: Tuesday, September 15, 2009 6:42:17 PM
Subject: Re: [R-sig-ME] How to define the fixed and random effects in lmer

Hello,

that should be fairly easy to do, instead of "random =..." you use brackets to specify the random effects. For example:

1. fixed effects for the intercept and slope and only random effect for the intercept is included

    lmer(Pre~t +(1|group), data= prec)



or

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


    lmer(Pre~t + (t|group), data= prec)




HTH


Cheers,


Luca


----- Messaggio originale -----
Da: "FMH" <kagba2006 at yahoo.com>
A: "Benjamin Michael Bolker" <bolker at ufl.edu>, r-sig-mixed-models at r-project.org
Inviato: Martedì, 15 settembre 2009 13:30:25 GMT -05:00 U.S.A./Canada, stati orientali
Oggetto: Re: [R-sig-ME] How to define the fixed and random effects in lmer

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)




_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models








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