Could anyone help me to understand how glm treats infinity?
The (log) odds ratio ranges from -Inf to +Inf.
log(((0)/(4))/((4-0)/(4)))
#-Inf
log(((2)/(4))/((4-2)/(4)))
#0
log(((4)/(4))/((4-4)/(4)))
#Inf
When you fit a model like below in glm, the intercept shows some values (e.g., 23.56606889) instead of Inf
d<-data.frame(ar=c(1,1,1,1))
m<-glm(ar~1,d,family=binomial)
coef(m)[1]
#(Intercept)
#23.56606889
This means that glm takes an approximation value: e.g.,
log(((3.999999999)/(4))/((4-3.999999999)/(4)))
#22.10956012
log(((3.9999999999)/(4))/((4-3.9999999999)/(4)))
#24.41214521
I would like to know how glm takes approximation values.