Skip to content

R-alpha: fitted = 0 of 1 in logistic regression

1 message · Peter Dalgaard

#
TASK:   problem with "glm" with binomial errors
STATUS: Open
FROM:   p.dalgaard@kubism.ku.dk
        in glm(,binomial) it's possible that loss of significant
        digits make expected values 0 or 1 even though there's no
        divergence of the fit.  (Happened to me with menarche data,
        infants and grown-ups included)
        [ Need the example data.  Glm needs a complete overhaul. ]

OK, here's a way to fake some data (simulated as if menarche occurs
uniformly between 10 an 15 years of age) There's no real problem with
fitting a logistic regression to this, but the logistic curve gets too
close to 0 and 1 for the very young and the very old.

BTW: rbinom gives NA for p=0 and p=1, which causes some problems with
the simulations. 
BTW2: Doesn't "occurred" take a double r?
Error: fitted probabilities of 0 or 1 occured
Call:  glm(fake2.menarche ~ fake2.age, binomial) 

Coefficients:
(Intercept)    fake2.age  
   -15.1061       1.2011  

Degrees of Freedom: 189 Total; 187 Residual
Null Deviance: 253.9 
Residual Deviance: 48.73