Skip to content
Prev 140565 / 398506 Next

dreaded p-val for d^2 of a glm / gam

I assume you mean 'deviance', not 'squared deviance';  if the 
latter, then I have no idea. 

      If the former, then a short and fairly quick answer to your 
question is that 2*log(likelihood ratio) for nested hypotheses is 
approximately chi-square with numbers of degrees of freedom = the number 
of parameters in the larger model fixed to get the smaller model, under 
standard regularity conditions, the most important of which is that the 
maximum likelihood is not at a boundary. 

      For specificity, consider the following modification of the first 
example in the 'glm' help page: 

     counts <- c(18,17,15,20,10,20,25,13,12)
     outcome <- gl(3,1,9)
     treatment <- gl(3,3)
     glm.D93 <- glm(counts ~ outcome + treatment, family=poisson())
     glm.D93t <- glm(counts ~ treatment, family=poisson())
     anova(glm.D93t, glm.D93, test="Chisq")

      The p-value is not printed by default, because some people would 
rather NOT give an answer than give an answer that might not be very 
accurate in the cases where this chi-square approximation is not very 
good.  To check that, you could do a Monte Carlo, refit the model with, 
say, 1000 random permutations of your response variable, collect 
anova(glm.D93t, glm.D93)[2, "Deviance"] in a vector, and then find out 
how extreme the deviance you actually got is relative to this 
permutation distribution. 

      Hope this helps. 
      Spencer Graves
p.s.  Regarding your 'dread', please see fortune("children")
Monica Pisica wrote: