[R] latex and anova.lme problem

Richard M. Heiberger rmh at temple.edu
Sun Oct 8 19:08:53 CEST 2006


It works for me.  I am also using R-2.4.0

> library(Hmisc)
> library(nlme)
> ?lme
> fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age
> fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
> anova(fm1,fm2)
    Model df      AIC      BIC    logLik   Test  L.Ratio p-value
fm1     1  6 454.6367 470.6173 -221.3183                        
fm2     2  5 447.5125 460.7823 -218.7562 1 vs 2 5.124178  0.0236
Warning message:
Fitted objects with different fixed effects. REML comparisons are not meaningful. in: anova.lme
(fm1, fm2) 
>
> fm1f <- lme(distance ~ age+Sex, data = Orthodont)  ## to avoid above warning message
> anova(fm1f,fm2)
     Model df      AIC      BIC    logLik   Test  L.Ratio p-value
fm1f     1 10 453.6604 480.2000 -216.8302                        
fm2      2  5 447.5125 460.7823 -218.7562 1 vs 2 3.852152  0.5709
> tmp.lme <- latex(anova(fm1f,fm2))
> getwd()  ## to find out where the anova.tex file was placed.


Therefore it is necessary for you to
 "provide commented, minimal, self-contained, reproducible code."

Rich



More information about the R-help mailing list