How to calculate Odds ratio and 95% confidence interval for logistic regression for the following data? I have the following data from a Research paper:
S1 : n = 30 / Rest : n = 66

SH      11  /      8

For this to calculate p-value I have done it like following:
library(MASS)
x = matrix(c(19,11,58,8), nrow=2, byrow=T)
D = factor(c("S1","SH"), levels=c("S1","SH"))
m = glm(x~D, family=binomial)
summary(m)

Call:
glm(formula = x ~ D, family = binomial)

Deviance Residuals: 
[1]  0  0

Coefficients:
        Estimate Std. Error z value Pr(>|z|)   
(Intercept)   0.5465     0.3789   1.443  0.14914   
DSH           1.4345     0.5346   2.683  0.00729 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance:  7.3387e+00  on 1  degrees of freedom
Residual deviance: -8.8818e-16  on 0  degrees of freedom
AIC: 11.607

Number of Fisher Scoring iterations: 3

The p-value is 0.007. This is same as I saw in the research paper. And the Odds Ratio is given as 4.20 and 95% CI is (1.47-11.97)
I would like to know how to calculate Odds Ratio and 95% Confidence interval for this? Can anyone please tell me how can I calculate this in R? Are there any functions?
 A: *

*$\exp(1.4345) \approx 4.20$

*$\exp(1.4345+1.96 \times 0.5346) \approx 11.97$

*$\exp(1.4345-1.96 \times 0.5346) \approx 1.472$


In R
> exp(summary(m)$coefficients["DSH",1] + 
+     qnorm(c(0.025,0.5,0.975)) * summary(m)$coefficients["DSH",2])
[1]  1.472098  4.197368 11.967884

A: You can also use the confint.default function which is based on asymptotic normality. 
exp(cbind("Odds ratio" = coef(m), confint.default(m, level = 0.95)))

A: Another possible way of calculating the Odds ratio, using your model 'm' would be as below:
# For odds ratio
m$coefficients
exp(m$coefficients)

And for finding the Confidence intervals, you can simply use:
# for confidence intervals
exp(confint(m))

Just for reference, the overall p-value (not just the p-value for each of the predictors) for logistic regression could also be computed:
summary(m)
(modelChi = m$null.deviance - m$deviance)  # for chi sq statistic
(chiDF = m$df.null - m$df.residual)        # for DF
(chisq_prob = 1 - pchisq(modelChi, chiDF)) # for hypothesis testing probability 

