# [R] Confidence Intervals for logistic regression

Michael Bedward michael.bedward at gmail.com
Fri Aug 6 10:46:41 CEST 2010

```Sorry about earlier reply - didn't read your email properly (obviously :)

You're suggestion was right, so as well as method for Aline below,
another way of doing the same thing is:

pred <- predict(y.glm, newdata= something, se.fit=TRUE)
ci <- matrix( c(pred\$fit + 1.96 * pred\$se.fit, pred\$fit - 1.96 *
pred\$se.fit), ncol=2 )

lines( something, plogis( ci[,1] ) )
lines( something, plogis( ci[,2] ) )

On 6 August 2010 18:39, aline uwimana <rwanuza at gmail.com> wrote:
> Dear Troy,
> use this commend, your will get IC95% and OR.
>
>  logistic.model <- glm(formula =y~ x1+x2, family = binomial)
> summary(logistic.model)
>
> sum.coef<-summary(logistic.model)\$coef
>
> est<-exp(sum.coef[,1])
> upper.ci<-exp(sum.coef[,1]+1.96*sum.coef[,2])
> lower.ci<-exp(sum.coef[,1]-1.96*sum.coef[,2])
>
> cbind(est,upper.ci,lower.ci)
>
> regards.
>
> 2010/8/6 Troy S <troysocks-twigs at yahoo.com>
>
>> Dear UseRs,
>>
>> I have fitted a logistic regression using glm and want a 95% confidence
>> interval on a response probability.  Can I use
>>
>> predict(model, newdata, se.fit=T)
>>
>> Will fit +/- 1.96se give me a 95% of the logit?  And then
>> exp(fit +/- 1.96se) / (exp(fit +/- 1.96se) +1) to get the probabilities?
>>
>> Troy
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help