[R] NLME and NA:s
bates at stat.wisc.edu
Thu Mar 23 19:57:29 CET 2000
"Patrik Waldmann" <Patrik.Waldmann at sysbot.lu.se> writes:
> I have an unbalanced data set with some factors and several
> variables. The missing values are spread unequally over the
> variables. Because of the unbalanced structure have i tried NLME,
> but I cannot understand how I should set up the na.omit. I would not
> like to use na.omit before setting up the model, as that would
> exclude too many observations (on the whole structure). Lets say I
> have data frame DATA, factor FACT and variables VAR1,VAR2... I first
> convert by using factor, and then set up the model as
fm1<- lme(VAR1~1, data=DATA, random=~1! FACT,na.omit(DATA$VAR1)).
> What have I done wrong?
First, note that it is the vertical bar character, |, not the
exclamation point, !, that is used to separate the grouping factor
from the linear model formula in the "random" argument. Your keyboard
may differ but the way you wrote the call to lme there won't work.
I think you can simply use
fm1 <- lme(VAR1~1, data=DATA, random=~1|FACT, na.action=na.omit)
to get the behavior you want.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help