On 2 Dec 2003 at 8:36, Phillip Good wrote:
> Are there assumptions that ought be satisfied for such a test to be
> appropriate?
>
I guess so, but not severely restrictive ones. Its a test of
linearity, assuming the rest of the usual assumptions to hold.
> phillip Good
>
> Barry Zajdlik <[log in to unmask]> wrote:
> Dear All,
>
> Lack of fit can be tested for the simple linear model using the
> following code:
>
> a<-lm(y~x)
> b<-lm(y~as.factor(x))
> anova(a,b)
>
> Can anyone point me to the analog for the generalized linear model
> case?
>
What about (of course only with an aproximate dist. theory)
> x <- sample(-2:2, 30, replace=TRUE)
> p <- exp(x)/(1+exp(x))
> y <- rbinom(30,1,p)
> mod1 <- glm(y ~ x, family=binomial)
> mod2 <- glm(y ~ as.factor(x), family=binomial)
> anova(mod1, mod2, test="Chisq")
Analysis of Deviance Table
Model 1: y ~ x
Model 2: y ~ as.factor(x)
Resid. Df Resid. Dev Df Deviance P(>|Chi|)
1 28 21.6138
2 25 20.7575 3 0.8563 0.8360
Kjetil Halvorsen
> Sincerely,
> Barry Zajdlik
>
> ---------------------------------
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
|