[R-sig-eco] Confidence intervals for predicted probabilities in logistic regression
Manuel Spínola
mspinola10 at gmail.com
Tue Jun 23 13:03:10 CEST 2009
Dear list members,
I am fitting a logistic regression and I want to calculate the predicted
probabilities of a response ("positive" and "negative") for a model with
one categorical predictor (2 levels, "yes" and "no").
oso.3 = glm(response ~ school, data=osologistic,
family=binomial(link="logit"))
For the reference level (the intercept, level "no") the point estimate is:,
> plogis(coef(oso.3)[1] + coef(oso.3)[2]*0)
(Intercept)
0.13
To calculate the confidence interval (lower and upper limit) I am using
the formula: beta0+beta1*x-1.96*se(beta0+beta1*x) and
beta0+beta1*x+1.96*se(beta0+beta1*x), using the variance and covariance
to calculate the standard error:
> errore.no = sqrt(1.14 + 1.73*02 + 2*-1.14*0)
> plogis(coef(oso.3)[1] + coef(oso.3)[2]*0-1.96*errore.no)
(Intercept)
0.017
> plogis(coef(oso.3)[1] + coef(oso.3)[2]*0+1.96*errore.no)
(Intercept)
0.54
However, when I use the confint function I got:
> plogis(confint(oso.3))
Waiting for profiling to be done...
2.5 % 97.5 %
(Intercept) 0.0076 0.45
schoolyes 0.8025 1.00
Here, I am looking at only to the intercept that is the reference level,
"no").
I was expecting to get the same lower and upper limit for the intercept.
Do you know why the results are different?
Do I need the covariance to calculate the se?
Thank you very much in advance.
Best,
Manuel
--
Manuel Spínola, Ph.D.
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola at una.ac.cr
mspinola10 at gamil.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
More information about the R-sig-ecology
mailing list