Epidemiologic Methods and Computing
Epidemiologic Reasoning, Data, and Bias
Epidemiologic findings depend not only on the amount of data collected or the sophistication of statistical software, but also on how the study is designed, how comparisons are made, and whether the data are inspected carefully. Large datasets and precise-looking estimates cannot compensate for biased comparisons or unsupported assumptions.
Historical Foundations: Using Data to Make Epidemiologic Inferences
John Graunt and the Bills of Mortality
In the mid-seventeenth century, John Graunt analyzed London’s Bills of Mortality, weekly records listing deaths and their reported causes. The records were compiled from information gathered by “searchers”: local women who examined the deceased and made inquiries about the cause of death.
Graunt used these records to draw conclusions that were not previously well established. Among other observations, he:
Identified that more male than female children were born.
Developed one of the early life tables.
Estimated London’s population using three different approaches, which produced remarkably similar results.
Examined population changes during and after plague years, observing that declines could be followed by increases in later years.
Considered explanations for the spread of plague, including whether it was contagious.
The historical value of Graunt’s work lies not only in the conclusions but also in the way he presented it. His publication included detailed tables of the underlying data, allowing readers to see the observations that supported his interpretations.
A central principle of epidemiologic reporting: Detailed data let readers assess how conclusions were reached and, where possible, conduct their own analyses.
John Snow and the “Natural Experiment”
In the nineteenth century, John Snow investigated cholera in London. Before germ theory was established, Snow proposed that cholera was transmitted through contaminated material entering the body by the mouth—what is now understood as fecal–oral transmission.
Snow is often associated with the removal of the handle from the Broad Street pump during a cholera outbreak. The well-known story can oversimplify the timing and circumstances: the outbreak had already begun to decline when the handle was removed, although there may have been reason to fear a resurgence.
Snow’s enduring epidemiologic contribution was his comparison of households supplied by two water companies:
The Lambeth Company had moved its water intake upriver, away from much of London’s sewage.
Southwark and Vauxhall continued to draw water from farther downriver, where sewage contamination was more likely.
In areas where both companies supplied homes, residents in neighboring houses could receive water from different companies. Many residents did not know which company supplied their household.
Snow compared cholera deaths among people supplied by the two companies. The communities were not randomized, and household water source was an imperfect measure of every person’s actual exposure: people might drink water outside the home. Nevertheless, the comparison showed a large difference—approximately a sevenfold difference in fatal cholera rates—consistent with contaminated water as a cause.
This comparison is called a natural experiment because circumstances outside the investigator’s control created a useful contrast between groups. Snow treated the comparison as having some of the advantages of a randomized experiment, although it was not literally randomized. His publications, like Graunt’s, included numerous detailed tables that documented the observations behind his conclusions.
Wynder and Graham: Smoking and Lung Cancer
In a landmark mid-twentieth-century case-control study, Ernest Wynder and Evarts Graham examined the relationship between tobacco smoking and lung cancer. Their published tables showed the data across age strata, making it possible to investigate whether differences in age might confound the association.
Age was important because lung cancer risk varies with age, and the smoking groups could differ in age composition. Epidemiologists can summarize comparisons across strata using methods such as the Mantel–Haenszel estimator, which combines stratum-specific information using weights.
Using the published table, a reader could reconstruct the counts and calculate an age-adjusted summary association. The lecture’s calculation gave an estimate of about 24 for the heaviest smoking category compared with nonsmokers. The important methodological point is that the original tables included enough detail for a reader to perform this analysis, even though the specific summary estimate was not reported in the paper.
Together, these historical examples show that epidemiologic analysis can be conducted with relatively simple tools when the data are organized and presented clearly. They also illustrate the value of publishing detailed results rather than only a final model coefficient.
Computing: Powerful Tool, Not a Substitute for Reasoning
Before electronic computers, researchers used punched-card systems such as McBee cards to sort observations and make cross-tabulations. Holes in each card encoded information; needles could separate cards according to a selected characteristic, such as sex. Researchers could then repeat the process for other variables and build tables.
Later, computing centers generated requested tables, sometimes overnight. Programmable calculators also made it easier to perform epidemiologic calculations from summary tables. These methods were slower than modern computing, but analysis time was generally small compared with the months or years needed to collect primary data.
The main lesson is not that older technologies were better. Modern computers make it possible to analyze large and complex datasets efficiently. However, ease of computation can also encourage researchers to analyze data without adequately checking what the data contain.
What can be lost when analysis becomes automated
Regression models and other statistical tools can summarize complex patterns, but they do not automatically reveal whether the data support those patterns. A plotted “dose–response curve,” for example, may show a smooth curve created by the assumed model rather than the irregular pattern actually observed in the data.
A responsible analysis should therefore include data inspection and transparent tabulation. In many settings, researchers can first examine stratified tables and then compare those results with a regression model. The model may be useful, but it should not be mistaken for a direct display of the raw evidence.
Misleading Comparisons: Age at Death Is Not a Mortality Rate
The left-handedness example
A published report claimed that left-handed people were at higher risk because their average age at death was lower than that of right-handed people. The comparison was misleading for two reasons:
It compared ages at death rather than age-specific death rates. The age at death of people who died does not account for the people in each group who remained alive.
The groups differed in age composition. In earlier generations, left-handed children were more often forced to use their right hands. As a result, older generations included a relatively larger proportion of right-handed people, while left-handed people were more likely to be younger.
A comparison of average age at death can therefore reflect differences in the ages and birth cohorts represented in each group, rather than differences in mortality risk. A proper mortality comparison needs to account for the population at risk in each age group, using age-specific death rates or an appropriate age-adjusted analysis.
The same error can be illustrated by comparing kindergarten students with soldiers. If only the ages of those who died are compared, the result might falsely suggest that the soldiers were safer. The comparison ignores how many people in each group were alive and at risk at each age.
An illustration of the cohort-composition problem is that, even when the same mortality rates are applied to populations with different age distributions, the observed average age at death can differ. The lecture gave an example in which the corresponding averages were about 72 for a predominantly older group and 58 for a younger group, despite identical mortality rates.
Longevity claims about music conductors
Claims that orchestra conductors live unusually long may also arise from selecting a group defined by an activity or occupation and then examining the ages of its members at death. Such observations do not establish that conducting causes longer life. People must survive long enough and be sufficiently healthy to become conductors; those who die before they could enter the occupation cannot appear among the conductors being studied.
Explanations such as the health benefits of music or the physical activity of conducting may sound plausible, but a plausible mechanism is not evidence that the observed longevity difference is real. The comparison needs an appropriate population and a design that addresses selection and differences between groups.
Bias in Studies of Vaccination and Surgery
The healthy vaccinee effect
Influenza vaccination is intended to prevent influenza illness and deaths. Some observational studies of older adults, however, reported an apparently enormous reduction—roughly 50%—in all-cause mortality among vaccinated people.
Such an estimate should prompt scrutiny. Influenza cannot plausibly account for half of all deaths during the winter if the seasonal rise in deaths is much smaller than that. In addition, studies found apparent mortality benefits even before influenza arrived, and benefits persisting after it had passed. These patterns suggest that the association is not explained solely by vaccine prevention of influenza deaths.
A likely explanation is the healthy vaccinee effect:
People who are severely ill or close to death may be less likely to receive vaccination.
Their deaths still contribute to the mortality rate among the unvaccinated.
This makes vaccinated people appear healthier, even if vaccination does not cause the full observed difference.
The influenza vaccine can prevent influenza-related deaths, but this does not imply that it prevents half of all deaths. In observational comparisons, researchers must distinguish the vaccine’s effect from differences in the health of people who do and do not receive it.
Cataract surgery and immortal time bias
An observational study of people diagnosed with cataracts compared all-cause mortality among those who later underwent cataract surgery with mortality among those who did not. It reported a very large apparent benefit: a mortality ratio near 0.4, with a narrow confidence interval of approximately 0.39 to 0.42.
The central problem was how people were classified. Follow-up began at cataract diagnosis, but surgical status was determined using information about whether surgery occurred later. To enter the surgery group, a person had to survive from diagnosis until the operation. Anyone who died before surgery could not be counted in the surgery group and was instead counted among those who had not received surgery.
This creates immortal time bias: the period between diagnosis and surgery is “immortal” with respect to membership in the surgery group because a person must remain alive long enough to be classified as having surgery. The comparison therefore unfairly assigns early deaths to the nonsurgical group.
Immortal time bias occurs when future information is used to classify people into groups, and survival until that future event is required for membership in one group.
The study’s implausibly large apparent benefit extended to causes of death that cataract surgery would not be expected to prevent, such as cancer and neurological disease. The analysis was later redone; the revised estimate was about 1.07, rather than 0.4.
A sound design must align exposure classification with the start of follow-up and avoid assigning person-time based on future events. Depending on the research question, approaches can include treating surgery as a time-varying exposure or defining a suitable comparison that starts at a common time point.
Skin cancer as a proxy for sun exposure
A Danish registry study used skin cancer as a marker of sun exposure and reported that people with certain skin cancers had lower mortality, including lower all-cause mortality. The study followed people from age 40, but skin cancer could occur years later.
As in the cataract example, exposure-group membership depended on a future event. A person classified in the skin-cancer group had to survive until the cancer was diagnosed. People who died before that diagnosis could not enter the exposed group. The resulting survival advantage can therefore arise from immortal time bias, not from a protective effect of sun exposure.
The estimate was strikingly strong, with a reported mortality ratio around 0.52 and a narrow confidence interval of about 0.52 to 0.53. Such precision does not remove bias: a very small P-value or narrow confidence interval can accompany a systematically biased estimate.
Sparse Data Bias in Highly Stratified Analyses
The beryllium and lung cancer example
Beryllium is used in some aerospace and technology applications. Exposure has largely been occupational, and historical worker data are especially important because contemporary exposure is much lower. A study of workers reported that the most heavily exposed group had about 3.7 times the lung cancer rate of the least exposed group. This finding contributed to the conclusion that beryllium is carcinogenic.
Occupational exposure often accumulates over time. Workers with the longest employment tend to have the highest cumulative exposure and are also older. Since lung cancer risk rises with age, age must be controlled to avoid confounding.
In a simple comparison without adjustment, the highest- versus lowest-exposure estimate was about 21.5. Controlling for age using seven age categories reduced it to about 2.6, a very large change. The published analysis then used a much more elaborate stratification involving:
16 five-year age categories.
14 five-year calendar-time categories.
2 race categories.
4 exposure categories.
Together, these combinations created roughly 1,800 strata, or cells. With around 400 lung cancer cases across those cells, many strata had very little information—less than half a case per cell on average.
Why sparse data can distort estimates
Sparse data bias can arise when an analysis divides limited observations across many categories. Estimates based on small counts are unstable, and measures such as ratios can be especially sensitive to zeros.
A coin-toss example illustrates the asymmetry. For a fair coin tossed a finite number of times, the ratio of heads to tails is usually near 1, but the ratio is infinite if every toss is heads because the number of tails is zero. Since the all-heads outcome has a nonzero probability, the expected ratio is infinite. Even if infinity is artificially replaced by a large finite value, the expected ratio can still be greater than 1.
The reason is that ratio measures are asymmetric: a zero in the denominator can produce an extremely large value, while the corresponding low ratios do not balance it out. With small counts, such extreme values can have substantial influence. This helps explain why a highly stratified analysis with many sparse cells can produce an exaggerated association.
Limited overlap between exposure groups
The beryllium data also showed limited overlap between exposure groups across age:
The most heavily exposed workers tended to be older.
Workers in the least-exposed group contributed much more person-time at younger ages.
In some older age categories, there was little information from the least-exposed group to compare with the heavily exposed group.
When groups have little overlap within strata, much of the data cannot contribute to a reliable like-with-like comparison. Careful tabulation can reveal this problem more clearly than a single summary estimate.
Simulation and interpretation
A simulation imposed the study’s highly detailed stratification on data in which beryllium had no effect on lung cancer. The resulting analysis still produced an estimate around 2.6, showing that the procedure itself could generate substantial upward bias under the null scenario.
The reported estimate of about 3.7 therefore required cautious interpretation. Adjusting for the estimated sparse-data bias yielded an estimate closer to 1.4, far below the original result. This does not by itself settle the causal question, but it demonstrates that the reported magnitude could be substantially inflated by the analysis method.
The broader lesson is that additional adjustment is not automatically better. More strata can reduce confounding only when the data support comparisons within those strata. Researchers should inspect the distribution of cases and person-time, assess overlap, and consider whether the chosen categories leave too many cells nearly empty.
Interpreting P-Values and Statistical Models
A small P-value does not repair a biased estimate
Several examples produced very small P-values or narrow confidence intervals despite major design or analysis problems. Statistical precision describes uncertainty under the assumptions of the calculation. It does not guarantee that the comparison is unbiased or that the assumptions are appropriate.
If the effect estimate is biased, a P-value calculated from that estimate may also be misleading. A very small P-value cannot convert a flawed comparison into valid evidence.
P-values as measures of compatibility
A P-value is best understood as a measure of how compatible the data are with a specified hypothesis under the assumptions of the analysis. It is not the probability that the hypothesis is true, and it should not be treated as a simple dividing line between “significant” and “not significant.”
For example, a result just above a conventional threshold—such as 0.051—does not establish the absence of an effect. The data may also be compatible with a wide range of other values. A researcher should not infer “no effect” merely because a test did not cross a chosen cutoff.
P-value functions
A P-value function shows the P-value associated with testing many possible hypotheses, rather than testing only a single null value. For a rate ratio, for example, the analysis can evaluate hypotheses that the ratio equals different values, not just 1.
The curve indicates how compatible the data are with each proposed value. Its peak occurs at the point estimate. Viewing the full function gives more information than reducing the analysis to one test and one threshold, because it shows how the evidence varies across plausible effect sizes.
Regression models and tabular inspection
Regression models can be valuable and can control for multiple variables. However, their results should be interpreted alongside the underlying data. A modeled curve may be much smoother than the observed data because the curve reflects the model’s assumptions rather than the raw pattern.
A useful practice is to begin with a stratified tabular analysis where feasible, inspect the actual counts and patterns, and then compare those results with a regression analysis. If the model and the tables disagree, the difference deserves investigation rather than automatic acceptance of the model output.
Practical Principles for Epidemiologic Analysis
Use the right comparison. Compare rates among people at risk, not merely the ages or outcomes of people who experienced an event.
Watch for future-dependent classification. If group membership depends on surviving until a later event, immortal time bias may result.
Consider who receives an intervention. People who are healthier or less close to death may be more likely to receive treatment or vaccination, creating a misleading apparent benefit.
Inspect the data directly. Tables of counts, person-time, and exposure distributions can reveal problems hidden by a summary estimate.
Check overlap and sparse cells. Adjustment is unreliable when comparison groups have little information in common within strata.
Treat precision cautiously. Narrow confidence intervals and very small P-values do not address bias or incorrect study design.
Make results reproducible. Detailed tables let readers evaluate the analysis and understand what the data actually show.
Epidemiology has relied on secondary data and careful observation since its earliest development. Computing makes analysis faster and more flexible, but sound inference still depends on knowing what was compared, how groups were formed, and what patterns are present in the data.

Ask anything
We've read this whole study set, so questions about it get the best answers.