[R] lme and mixed effects
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Tue Jan 22 16:56:45 CET 2002
Douglas Bates <bates at stat.wisc.edu> writes:
> Doug Davidson <dvdsn at printhost.beckman.uiuc.edu> writes:
>
> > With lme, is there a way to specify multiple fixed factors under one
> > level of grouping?
>
> I'm not sure I understand the question. Can you tell us more about
> the model that you want to fit?
>
> If you mean that you want a random interaction term then you might
> want to check the description in section 1.3 of Pinheiro and Bates
> (Springer, 2000) on different ways that interactions can be expressed
> in lme.
I read it as two crossed within-subject terms. lme() is not quite
built for that with its emphasis on nested random effects, but this
kind of stuff has worked for me before:
> lme((y~fact1*fact2,
+ random=list(subj=pdIdent(form=~fact1-1),
+ subj=~1,
+ fact2=~1),
(That implies a subj within subj grouping, but the algorithm treats
that just like subj.)
> > For example, for a single fixed factor, I use the following:
> >
> > fm1.lme <- lme(fixed=resp ~ fact1, random=~1|subj/fact1, data=mydata)
> >
> >
> > I would like to have multiple factors under subj, like the following
> > for a two-way design, but I get an error:
> >
> >
> > fm2.lme <- lme(fixed=resp ~ fact1*fact2, random=~1|subj/(fact1+fact2), data=mydata)
>
> --
> Douglas Bates bates at stat.wisc.edu
> Statistics Department 608/262-2598
> University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
mailing list