Douglas Grove kindly pointed out that, if I had read and understood
the lme help page, I would have realized that whatever I put as the
subset argument has to be an object in the argument for data.  That
was my problem all along -- if I had used

subset=Diagnosis==0

in the lme function call, that would have been fine.  But I originally had

subset=dat$Diagnosis==0

and that didn't work because dat was not an object in dat.

So the problem was caused by my incorrect usage of lme.

Many thanks for the help and suggestions!

Todd


> Is this inside a function or at the R prompt?
> 
>       -thomas
> 
> 
> 
> 
> 
> > Todd
> > [EMAIL PROTECTED]
> >
> > >
> > > Todd Ogden wrote:
> > >
> > > > I'm puzzled by the following problem, which appears when
> > > > attempting to run an analysis on part of a dataset:
> > > >
> > > > If I try:
> > > >
> > > >   csubset <- dat$Diagnosis==0
> > > >   cont <- lme(fixed=cform,
> > > >                    random = ~1|StudyName,
> > > >                       data=dat,subset=csubset,na.action=na.omit)
> > > >
> > > > Then I get:
> > > >
> > > > Error in eval(expr, envir, enclos) : Object "csubset" not found
> > > >
> > > > But if I do instead:
> > > >
> > > >   cdat <- dat[dat$Diagnosis==0,]
> > > >   cont <- lme(fixed=cform,
> > > >                    random = ~1|StudyName,
> > > >                       data=cdat,na.action=na.omit)
> > > >
> > > > Then everything is fine.
> > > >
> > > > I'm puzzled that the object can't be found.  Maybe I'm
> > > > overlooking something obvious?
> > > >
> > >
> > > Todd,
> > >    What version of R/nlme? I just tried the following:
> > >
> > > library(nlme)
> > > data(Orthodont)
> > > csubset <- Orthodont$Sex == "Male"
> > > fm1 <- lme(distance ~ age, data = Orthodont,
> > >             random = ~ 1, subset = csubset)
> > > fm2 <- lme(distance ~ age, data = Orthodont,
> > >             random = ~ 1, subset = Sex == "Male")
> > > fm3 <- lme(distance ~ age, data = Orthodont[csubset, ],
> > >             random = ~ 1)
> > >
> > >  > R.version.string
> > > [1] "R version 1.9.0, 2004-05-06"
> > > R> library(help = "nlme")
> > >
> > >           Information on Package 'nlme'
> > >
> > > Description:
> > >
> > > Package: nlme
> > > Version: 3.1-48
> > > Date: 2004/01/14
> > > <snip>
> > >
> > > --sundar
> > >
> > >
> > >
> > >
> >
> >
> > --
> >
> > ______________________________________________
> > [EMAIL PROTECTED] mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> 
> Thomas Lumley                 Assoc. Professor, Biostatistics
> [EMAIL PROTECTED]     University of Washington, Seattle
> 


--

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

Reply via email to