On Aug 23, 2009, at 10:14 AM, Brittany Hall wrote:

Hello,

I am fairly new to R and having a problem with the lme command. I have searched on forums, read the Fox 2002 chapter, and R help, but the suggestions that I have tried have not helped me.

My data file is called Acsdata.

This is my script:

Acsdata.1 <- lme(Acsdata$gsi ~ Acsdata$asitotal + Acsdata$famstrto + as.factor(Acsdata$GEN) + Acsdata$asxfs + Acsdata$asxpar + Acsdata $asxgp + Acsdata$asxfsxpa + Acsdata$asxfsxgp, random = ~1|Acsdata $family)

I keep getting the error: object "gsi" not found. However, when I use the summary function, R is able to recognize gsi.

I welcome any suggestions.

Thanks

Be sure that the Acsdata data frame is not attach()ed. That can cause certain conflicts.

Then, be sure to utilize the 'data' argument that is available in R functions that take formulae as arguments. So use:

Acsdata.1 <- lme(gsi ~ asitotal + famstrto + as.factor(GEN) + asxfs + asxpar + asxgp + asxfsxpa + asxfsxgp,
                 random = ~1|family, data = Acsdata)


I also think that it would be 'cleaner' to coerce 'GEN' to a factor before calling lme(). It results in more readable output from the function and it's methods.

See 'An Introduction to R', available in your R distribution or online at http://cran.r-project.org/manuals.html for general information on using modeling functions.

Addtionally, as you progress through this, you may have follow on questions and there is a focused R e-mail list on mixed models. See https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models for more information.

Finally, in addition to John's excellent book that you reference above, the seminal reference for lme() is:

Jose C. Pinheiro and Douglas M. Bates
Mixed-Effects Models in S and S-Plus
Springer, 2000. ISBN 0-387-98957-0


HTH,

Marc Schwartz

______________________________________________
R-help@r-project.org 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.

Reply via email to