Home  /  Resources & Support  /  Introduction to Stata basics  /  Incidence-rate ratio calculator

Sometimes, we are given summary data and asked to estimate the incidence rate, incidence-rate difference, incidence-rate ratio, and confidence intervals.

This is common in prospective cohort studies where a sample of people without a condition (noncases) is followed over time to see who develops the condition (cases). The sample is typically divided into one group who were exposed to a possible risk factor and another group who were not exposed. Exposure to the risk factor is typically measured in "person-time". A person who is followed for two years contributes two "person-years", while a person who is followed for five years contributes five "person-years".

For example, we could follow a healthy group of people who are exposed to a possible carcinogen and a healthy group who are not exposed. Then we can count the number of people in each group who develop cancer. We can estimate the incidence rate metrics using Stata's iri command command followed by four numbers:

The number of cases in the exposed group (41)
The number of cases in the unexposed group (15)
The number of person-years in the exposed group (28,010)
The number of person-years in the unexposed group (19,017)

. iri 41 15 28010 19017

Exposed Unexposed Total
Cases 41 15 56
Person-time 28010 19017 47027
Incidence rate .0014638 .0007888 .0011908
Point estimate [95% conf. interval]
Inc. rate diff. .000675 .0000749 .0012751
Inc. rate ratio 1.855759 1.005684 3.6093 (exact)
Attr. frac. ex. .4611368 .0056519 .722938 (exact)
Attr. frac. pop .337618
Mid-p-values for tests of incidence-rate difference: Adj Pr(Exposed cases <= 41) = 0.9823 (lower one-sided) Adj Pr(Exposed cases >= 41) = 0.0177 (upper one-sided) Two-sided p-value = 0.0355

The output gives us a lot of information.

The overall incidence rate is .0012 cases per person-year. The incidence rate in the exposed group is .0015 cases per person-year, and the incidence rate in the unexposed group is .0008 cases per person-year.

The incidence rate difference (IRD) is the difference between the incidence rate in the exposed group and the incidence rate in the unexposed group. Here the IRD and 95% confidence interval is 0.0007 (0.0001 - 0.0013).

The incidence rate ratio (IRR) is the incidence rate in the exposed group divided by the incidence rate in the unexposed group. Here the IRR and 95% confidence interval is 1.86 (1.01 - 3.61).

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 is 0.46 (0.01 - 0.72).

The attributable fraction for the population (AFP) is the net proportion of all cases attributable to exposure. Here the AFP is 0.34.

At the bottom of the table, iri reports one- and two-sided tests of the IRD. For the one-sided test of the number of exposed cases being 41 or greater, the p-value is 0.0177. The two-sided test is twice the smallest one-sided p-value and is 0.0355. These p-values are calculated using the mid-p adjustment to exact p-values.

We can use the exact option to report exact p-values.

. iri 41 15 28010 19017, exact

Exposed Unexposed Total
Cases 41 15 56
Person-time 28010 19017 47027
Incidence rate .0014638 .0007888 .0011908
Point estimate [95% conf. interval]
Inc. rate diff. .000675 .0000749 .0012751
Inc. rate ratio 1.855759 1.005684 3.6093 (exact)
Attr. frac. ex. .4611368 .0056519 .722938 (exact)
Attr. frac. pop .337618
Exact p-values for tests of incidence-rate difference: Pr(Exposed cases <= 41) = 0.9884 (lower one-sided) Pr(Exposed cases >= 41) = 0.0238 (upper one-sided) Two-sided p-value = 0.0477

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.