I stumbled across a mild glitch when trying to compare the
result of gam() fitting with the result of lm() fitting.

The following code demonstrates the problem:

library(gam)
x <- rep(1:10,10)
set.seed(42)
y <- rnorm(100)
fit1 <- lm(y~x)
fit2 <- gam(y~lo(x))
fit3 <- lm(y~factor(x))
print(anova(fit1,fit2)) # No worries.
print(anova(fit1,fit3)) # Likewise.
print(anova(fit2,fit3)) # Throws an error.
print(anova(fit3,fit2)) # ``Works'' but gives negative degrees of freedom and sum of squares.

Is this evidence of a ``bug''? Or am I being terribly young and naive to
expect anova() to work at all in such circumstances?

The error thrown is:

Error in anova.glmlist(list(object, ...), test = test) :
  (list) object cannot be coerced to type 'double'

        cheers,

                Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org 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.

Reply via email to