From Doug Altman’s paper “How to obtain the confidence interval from a P value” BMJ 2011;343:d2090
Steps to calculate CI for a difference Est from p-value
- calculate the test statistic for a normal distribution test, z, from p:
- calculate the standard error:
- calculate the 95% CI:
- For a 90% CI, we replace 1.96 by 1.65; for a 99% CI we use 2.57 (Altman 2011).
Let’s estimate the 95%CI if the abstract states that “more patients in the zinc group than in the control group recovered by two days (49% v 32%, p=0.032)” (Roy 2008).
est <- 17 p <- 0.032 z <- -0.862 + sqrt(0.743 - 2.404 * log(p)) se <- abs(est/z); se
##  7.940458
ci.low <- est - 1.96*se; ci.hi <- est + 1.96*se cat (paste0(format(round(est, 1), nsmall=2), " (95%CI ", format(round(est - 1.96*se, 1), nsmall=1), " - ", format(round(est + 1.96*se, 1), nsmall=1)), ")" )
## 17.00 (95%CI 1.4 - 32.6 )
Steps to calculate CI for a ratio Est from p-value
For ratio measures such as RR, the above formulas should be used with the estimate Est on the log scale . Step 3 above will give a CI on the log scale; to derive the CI on the natural scale we need to exponentiate Est and its CI (Bland 1996)
The abstract of a report of a cohort study includes the statement that “In those with a [diastolic blood pressure] reading of 95-99 mm Hg the relative risk was 0.30 (P=0.034).” What is the confidence interval around 0.30 (Lindblad 1994)?
est <- 0.30 p <- 0.034 z <- -0.862 + sqrt(0.743 - 2.404 * log(p)); z
##  2.116569
se <- abs(log(est)/z); se # use ln of `est`
##  0.5688323
#exponentiate back to get the confidence limits ci.low <- exp(log(est) - 1.96*se); ci.hi <- exp(log(est) + 1.96*se) cat (paste0(format(round(est, 1), nsmall=2), " (95%CI ", format(round(ci.low, 1), nsmall=2), " - ", format(round(ci.hi, 1), nsmall=2)), ")" )
## 0.30 (95%CI 0.10 - 0.90 )
This method is approximately correct in studeis done with n=60+ pts.
- Altman, D, Bland, JM. How to obtain the confidence interval from a P value. BMJ 2011; 343:d2090
- Bland JM, Altman DG. Statistics Notes. Logarithms. BMJ 1996; 312:700.
- Roy SK, Hossain MJ, Khatun W, Chakraborty B, Chowdhury S, Begum A, et al. Zinc supplementation in children with cholera in Bangladesh: randomised controlled trial. BMJ 2008; 336:266-8.
- Lindblad U, Råstam L, Rydén L, Ranstam J, Isacsson S-O, Berglund G. Control of blood pressure and risk of first acute myocardial infarction: Skaraborg hypertension project. BMJ 1994; 308:681.