Re: [R] lme syntax for P&B examples

From: Doran, Harold <HDoran_at_air.org>
Date: Thu 09 Feb 2006 - 00:01:03 EST


Paul:

It is a little difficult to understand what you are trying to translate since you do not show what the model would look like using lme. If you show lme, then it is easy to translate into lmer syntax.

A few thoughts, first, use lmer in the Matrix package and not in lme4. Second, see the Bates article in R news at the link below for dealing with nesting structures. Last, a colleague and I have a paper in press showing how to fit models using lme which we submitted a year or so ago. Since lme has evolved to lmer, we created an appendix that translates all of our lme models to the lmer syntax so readers can see equivalences. I am happy to send this to you (or others) upon request.

http://cran.r-project.org/doc/Rnews/Rnews_2005-1.pdf

Harold  

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Paul Cossens Sent: Wednesday, February 08, 2006 12:08 AM To: r-help@stat.math.ethz.ch
Subject: [R] lme syntax for P&B examples

Hi helpeRs,  

I've been working through some examples in Pinhiero & Bates( 2000) trying to understand how to translate to the new Lme4 syntax but without much luck.
Below is what I think I should do, but either the answers don't come out the same or I get errors.
In the Oxide problems I'm particularly interested in obtaining the levels coeficients but this options no longer seems to be available in lme4. How can levels infor be obtained in lme4?  

If someone can recreate the examples below in lme4 syntax so I can follow what is happening in the text I'd be grateful.  

Cheers  

Paul Cossens    

#Pixel
# P&B(2000) p40-45  

Pixel<-read.csv("Pixel.csv",header=TRUE); Pixel$Side<-as.factor(Pixel$Side)
Pixel$Dog<-as.factor(Pixel$Dog)  

(fm1Pixel <- lmer(pixel ~ day + I(day^2) +(day|Dog)+(1|Side), data =
Pixel))
(fm2Pixel <- lmer(pixel ~ day + I(day^2) +(day|Dog), data = Pixel))
(fm3Pixel <- lmer(pixel ~ day + I(day^2) +(1|Dog:Side), data = Pixel))
or should I do it this way?
Pixel$DS<-with(Pixel,Dog:Side)[drop=TRUE]
(fm3Pixel <- lmer(pixel ~ day + I(day^2) +(1|DS), data = Pixel))
 

(fm4Pixel <- lmer(pixel ~ day + I(day^2) +Side , data = Pixel))
 

#Oxide
# P&B(2000) p167-170  

Oxide<-read.csv("Oxide.csv",header=TRUE);

Oxide$Source<-as.factor(Oxide$Source)
Oxide$Lot<-as.factor(Oxide$Lot)
Oxide$Wafer<-as.factor(Oxide$Wafer)
Oxide$Site<-as.factor(Oxide$Site)

fm1Oxide<-lmer(Thickness~ (1|Lot)+(1|Lot:Wafer),data=Oxide) )
(fm2Oxide<-lmer(Thickness~ (1|Lot),data=Oxide) )
coef(fm1Oxide)

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Feb 09 00:23:52 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:26 EST