Sometimes, we are given summary data and asked to estimate the risk ratio and risk difference with confidence intervals.
For example, we might be asked to estimate the risk ratio and risk difference for 12 cases and 55 noncases among exposed subjects and 16 cases and 125 noncases among unexposed subjects. We can do this using Stata's csi command command followed by four numbers:
The number of exposed cases (12)
. csi 12 16 55 125
Exposed Unexposed | Total | |
Cases | 12 16 | 28 |
Noncases | 55 125 | 180 |
Total | 67 141 | 208 |
Risk | .1791045 .1134752 | .1346154 |
Point estimate | [95% conf. interval] | |
Risk difference | .0656293 | -.0400614 .17132 |
Risk ratio | 1.578358 | .7919346 3.145733 |
Attr. frac. ex. | .3664303 | -.2627305 .682109 |
Attr. frac. pop | .1570415 |
The output gives us a lot of information.
The overall risk of being a case is 0.13, the risk in the exposed group is 0.18, and the risk in the unexposed group is 0.11.
The risk difference is the difference between the risk in the exposed group and the risk in the unexposed group. Here the risk difference and 95% confidence interval are 0.06 [-0.04, 0.17].
The risk ratio is the risk in the exposed group divided by the risk in the unexposed group. Here the risk ratio and 95% confidence interval are 1.58 [0.79, 3.15].
The attributable fraction among the exposed (AFE) is an estimate of the proportion of exposed cases attributable to exposure. Here the AFE and 95% confidence interval are 0.37 [-0.26, 0.68].
The attributable fraction for the population (AFP) is the net proportion of all cases attributable to exposure. Here the AFP is 0.16.
The \(x^2\) statistic at the bottom of the table tests for an association between exposure status and case status. Here the one degree-of-freedom \(x^2\) statistic equals 1.68 with a p-value of 0.1950.
It is often appropriate to use the exact option for small sample sizes. This will report 1-sided and 2-sided p-values for Fisher's exact tests. We can also include the or option if we wish to report an odds ratio with a 95% confidence interval.
. csi 12 16 55 125, exact or
Exposed Unexposed | Total | |
Cases | 12 16 | 28 |
Noncases | 55 125 | 180 |
Total | 67 141 | 208 |
Risk | .1791045 .1134752 | .1346154 |
Point estimate | [95% conf. interval] | |
Risk difference | .0656293 | -.0400614 .17132 |
Risk ratio | 1.578358 | .7919346 3.145733 |
Attr. frac. ex. | .3664303 | -.2627305 .682109 |
Attr. frac. pop | .1570415 | |
Odds ratio | 1.704545 | .7670751 3.793285 (Cornfield) |
The odds ratio is the odds of being a case in the exposed group divided by the odds of being a case in the unexposed group. Here the odds ratio and 95% confidence interval are 1.70 [0.77, 3.79].
You can watch a demonstration of these commands by clicking on the link to the YouTube video below. You can read more about these commands by clicking on the links to the Stata manual entries below.
Read more in the Stata Data Management Reference Manual; see [D] describe. In the Stata Base Reference Manual, see [R] epitab.