[R] confint for glm (general linear model)

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Dec 13 10:20:00 CET 2009


David Winsemius wrote:
> 
> On Dec 12, 2009, at 8:19 PM, casperyc wrote:
> 
>>
>> for an example,
>>
>>
>> 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())
>> confint(glm.D93)
>> confint.default(glm.D93)  # based on asymptotic normality
>>
>> to verify the confidence interval (confint.default(glm.D93))  for 
>> outcome2
>>
>> -4.542553e-01 + c(-1,1) * 0.2021708 * qt(0.975,df=4)
>> -1.0155714  0.1070608
>>
>> does not give me
>> outcome2    -0.8505027 -0.05800787
>> as in confint.default(glm.D93)
> 
> But this does (up to rounding anyway):
> 
>  > coef(summary(glm.D93))[2,1] + c(-1,1) * 
> coef(summary(glm.D93))[2,2]*qnorm(0.975)
> [1] -0.85050267 -0.05800787
> 
> I can understand thinking that the CI's might be t-distributed but the 
> usual formulation is that they are normally distributed.
> 
>>

Right, and 4 DF is just plain wrong. There is no "estimated variance" 
for the Poisson distribution like there is in the Gaussian models. E.g., 
it makes sense to calculate a CI for the true log-mean based on a single 
Poisson outcome:

 > x <- 50
 > confint(glm(x~1, family=poisson))
Waiting for profiling to be done...
    2.5 %   97.5 %
3.621423 4.176967


-- 
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907




More information about the R-help mailing list