[R] lme questions

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Aug 29 12:53:31 CEST 2001


On Wed, 29 Aug 2001, Christian Hennig wrote:

> Dear list,
>
> the following should fit the model
> log(PEPC.Wert)=fKTemp+fHerk+interaction(fKTemp,fHerk)+fMub+error,
> where fKTemp, fHerk are fixed effect factors and fMub is a random effects
> factor nested in fHerk (values are different fopr different values of
> fHerk).
>
> > logpepcr1 <- lme(log(PEPC.Wert) ~ fKTemp*fHerk, random= ~ 1 | fMub, na.action=na.omit)
>
> The following should be without the random factor:
>
> > logpepcr0 <- lme(log(PEPC.Wert) ~ fKTemp*fHerk,na.action=na.omit)
> Error in getGroups.data.frame(dataMix, groups) :
> 	Invalid formula for groups
>
> OK, I try with lm:
>
> > logpepcr0 <- lm(log(PEPC.Wert) ~ fKTemp*fHerk,na.action=na.omit)
>
> ...works.
>
> Is the following correct for testing the significance of the
> random factor?
>
> > anova.lme(logpepcr0,logpepcr1)
>           Model df      AIC      BIC    logLik   Test  L.Ratio p-value
> logpepcr0     1 10 3977.354 4030.318 -1978.677
> logpepcr1     2 11 3885.392 3943.653 -1931.696 1 vs 2 93.96144  <.0001

No.  You need to fit the lme model by maximum likelihood, not the default
REML, to be comparable with the lm fit.

> Where can I get an estimator for the variance of the random factor fMub?

The standard error is in the summary() output.


> Is there a way to specify an interaction between fMub and fKTemp?
>
> And why does this happen?
>
> > plot(logpepcr1)
> Error in do.call(plotFun, as.list(args)) :
> 	couldn't find function "xyplot"

That's a legacy of the S origins: xyplot is in package lattice in the
Devel section on CRAN (needs grid too) and I don't know if it
yet suffices for plot.lme.


> (plot(logpepcr0) works; I use R 1.3.0 on Solaris.)

That's using plot.lm.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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