[R] Random Effects Model

Rene Braeckman RMan54 at cox.net
Tue Dec 19 04:56:07 CET 2006


If these are the only variables, you are missing Type. Swim and Type are
both conditioning variables that you need to provide. Maybe your intention
is to use Sex instead of Type.
Try:

?xyplot

And look under x as the 1st argument for xyplot.

Rene 

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of readams at colby.edu
Sent: Monday, December 18, 2006 7:19 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Random Effects Model

Hello,

I am new to R, and I am trying to figure out how to use it for a random
effects model. I am using version 2.4.0, and I also have the book Applied
Linear Regression by Sanford Weisberg.

I have four variables: Swimmer, Sex, Swim, and Difference.  Swimmer
identifies the number assigned to a particular person. Sex is male/female.
Swim identifies the number swim from 1 to 6. Difference is my variable of
interest (random).

The book says I should run something like this:

> library(nlme)
> data(FREE) #FREE is my dataset
> xyplot(Difference~Swim|Type, group=Swimmer, data=FREE,
+     panel.groups=function(x,y,...){
+       panel.linejoin(x,y,horizontal=FALSE,...)}
+     )
> m1 <- lme(Difference~Swim+Type, data=FREE, random=~1+Type|Swimmer)
> m2 <- update(m1, random=~1|Swimmer)

I've pretty much decided that xyplot doesn't work. Instead, I think plot
will work much better.  I keep getting errors about Type. Can someone
explain this to me? Does the code above look right?

Any kind of help will be appreciated...

Thanks in advance!

Ryan

______________________________________________
R-help at 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
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list