I have fit a logistic model and I want to know the value of x when y=0.5.
library("faraway")
data = read.table("SBay.txt", header=T)
female = subset(data,sex==2)
amat = c(0,1)
mod1 = glm(amat[maturity]~age,family=binomial,data=female)
summary(mod1)
(len_50 = (log(1)-mod1$coef[1]) /mod1$coef[2])
(plot(female$age,amat[female$maturity],pch=1,col=2))
s = seq(0, 20, 0.1)
lines(s,ilogit(mod1$coef[1]+mod1$coef[2]*s),col=2,lty=2,lwd=2)
I google the answer and get:
F1 = ilogit(mod1$coef[1]+mod1$coef[2])
F2 = 0.5
solve(F1,F2)
I got the answer equal to 9.931613, however, it doesn't match the graph I've plot. SO I think there might be something wrong with my code. Here are my graph, it seem the answer is between 2 and 3.