[R] glm and lrm disagree with zero table cells

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Oct 24 19:54:10 CEST 2002


Eric Rescorla <ekr at rtfm.com> writes:

> I've noticed that glm and lrm give extremely different results if you
> attempt to fit a saturated model to a dataset with zero cells. Consider,
...
> Coefficients:
>                   Estimate Std. Error z value Pr(>|z|)    
> (Intercept)        -2.7830     0.4207  -6.615 3.71e-11 ***
> DEFWHITE           -4.7823     8.8981  -0.537   0.5910    
> VICWHITE            1.2296     0.5358   2.295   0.0217 *  
> DEFWHITE:VICWHITE   4.3973     8.9076   0.494   0.6216    
> ---
> Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 
> 
> (Dispersion parameter for binomial family taken to be 1)
> 
>     Null deviance: 226.51  on 325  degrees of freedom
> Residual deviance: 218.39  on 322  degrees of freedom
...
>        Obs  Max Deriv Model L.R.       d.f.          P          C        Dxy 
>        326      0.002       8.13          3     0.0435      0.624      0.248 
>      Gamma      Tau-a         R2      Brier 
>      0.383      0.049      0.049      0.096 
> 
>                       Coef   S.E.    Wald Z P     
> Intercept             -2.783  0.4207 -6.62  0.0000
> DEF=WHITE             -5.490 20.8691 -0.26  0.7925
> VIC=WHITE              1.230  0.5358  2.29  0.0217
> DEF=WHITE * VIC=WHITE  5.105 20.8732  0.24  0.8068

These are *not* extremely different! In fact, they are essentially
equivalent. The maximum likelihood estimates of the 2nd and 4th
coefficients are theoretically infinite, and it is only a matter of
when the two routines decide to stop the iterations. The 1st and 3rd
coefficients are the same, so are their SEs, and also the sum of the
2nd and 4th is -.39 in both cases. The likelihood ratio in the first
model is 226.51-218.39 = 8.12 and in the second it is given as 8.13.

[And where did lrm() come from? It's not in the standard packages, and
I'm not going to wade through 150+ CRAN packages to locate it...] 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list