Dear R-helpers,
When I try
> anova(txtE2.lme, txtE2.lme1)
Model df AIC BIC logLik Test L.Ratio p-value
txtE2.lme 1 10 8590 8638 -4285
txtE2.lme1 2 7 8591 8624 -4288 1 vs 2 6.79 0.0789
> latex(anova(txtE2.lme, txtE2.lme1))
Error: object "n.group" not found
I don't even see n.group as one of the arguments of latex()
I checked to see
> class(anova(txtE2.lme, txtE2.lme1))
[1] "anova.lme" "data.frame"
A bit more information (which I don't know is relevant):
> methods(anova.lme)
no methods were found
Warning message:
function 'anova.lme' appears not to be generic in: methods(anova.lme)
> methods(latex)
[1] latex.bystats latex.bystats2
latex.default
[4] latex.describe latex.describe.single
latex.function
[7] latex.list latex.summary.formula.cross
latex.summary.formula.response
[10] latex.summary.formula.reverse
*********************sessionInfo()************************
R version 2.4.0 (2006-10-03)
powerpc-apple-darwin8.7.0
locale:
C
attached base packages:
[1] "datasets" "methods" "stats"
"graphics" "grDevices"
"utils" "base"
other attached packages:
Hmisc chron xtable geepack glmmML
nlme lme4 Matrix lattice
"3.1-1" "2.3-8" "1.3-2"
"1.0-10" "0.65-3" "3.1-77"
"0.9975-1" "0.9975-2" "0.14-9"
MASS JGR iplots JavaGD rJava
"7.2-29" "1.4-11" "1.0-4"
"0.3-5" "0.4-10"
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
Michael Kubovy wrote:> Dear R-helpers, > > When I try > > anova(txtE2.lme, txtE2.lme1) > Model df AIC BIC logLik Test L.Ratio p-value > txtE2.lme 1 10 8590 8638 -4285 > txtE2.lme1 2 7 8591 8624 -4288 1 vs 2 6.79 0.0789 > > latex(anova(txtE2.lme, txtE2.lme1)) > Error: object "n.group" not foundMichael, As far as I know, no one has implemented a latex method for anova.lme objects. You are trying to use a default latex method for a complex object. n.group is an argument to latex.default in the Hmisc package Frank> > I don't even see n.group as one of the arguments of latex() > > I checked to see > > class(anova(txtE2.lme, txtE2.lme1)) > [1] "anova.lme" "data.frame" > > A bit more information (which I don't know is relevant): > > methods(anova.lme) > no methods were found > Warning message: > function 'anova.lme' appears not to be generic in: methods(anova.lme) > > methods(latex) > [1] latex.bystats latex.bystats2 > latex.default > [4] latex.describe latex.describe.single > latex.function > [7] latex.list latex.summary.formula.cross > latex.summary.formula.response > [10] latex.summary.formula.reverse > > > *********************sessionInfo()************************ > R version 2.4.0 (2006-10-03) > powerpc-apple-darwin8.7.0 > > locale: > C > > attached base packages: > [1] "datasets" "methods" "stats" "graphics" "grDevices" > "utils" "base" > > other attached packages: > Hmisc chron xtable geepack glmmML > nlme lme4 Matrix lattice > "3.1-1" "2.3-8" "1.3-2" "1.0-10" "0.65-3" "3.1-77" > "0.9975-1" "0.9975-2" "0.14-9" > MASS JGR iplots JavaGD rJava > "7.2-29" "1.4-11" "1.0-4" "0.3-5" "0.4-10" > > _____________________________ > Professor Michael Kubovy > University of Virginia > Department of Psychology > USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 > Parcels: Room 102 Gilmer Hall > McCormick Road Charlottesville, VA 22903 > Office: B011 +1-434-982-4729 > Lab: B019 +1-434-982-4751 > Fax: +1-434-982-4766 > WWW: http://www.people.virginia.edu/~mk9y/ > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
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