PUBH-311 · Lesson 12 of 12 · 22 min
Analysing a public health data set
▶ Video coming soon A video version of this lesson is on the way.
In October, the Kestrel Valley board of health asked for a briefing on household food insecurity. A local food bank had reported record demand, and a trustee wanted to know whether food insecurity was linked to residents’ health. Dr. Osei gave Jonah the lead on the analysis, with one condition: he had to write the analysis plan before running a single test. Over the next three weeks Jonah used almost every tool from this course, from variable types and descriptive tables to chi-square tests, effect measures, logistic regression and careful reporting. This capstone lesson follows his analysis step by step, so that you can see how the pieces fit together, and then asks you to judge his choices and extend the work.
The data are the invented Kestrel Valley Community Health Survey used throughout the course: 1,200 adults sampled at random from the region, with interview and measured data. The steps follow the workflow in Figure 1. At each step, ask yourself what you would have done differently.
Step 1: Frame the question
A vague question ("is food insecurity bad for health?") cannot be answered with data. Jonah narrowed it using the elements familiar from evidence-based practice: the population, the exposure, the comparison and the outcome.
- Population: adults aged 18 and older living in Kestrel Valley.
- Exposure: household food insecurity (moderate or severe), measured with the Household Food Security Survey Module used in Canadian surveys, an 18-item questionnaire that classifies households by the severity of their food-related hardship.
- Comparison: adults in food-secure households.
- Outcome: self-rated health of fair or poor (versus good, very good or excellent).
The primary question became: "Among adults in Kestrel Valley, is household food insecurity associated with fair or poor self-rated health, and does any association persist after accounting for age, sex, household income and smoking?" Self-rated health was chosen because it is a well-validated single question that strongly predicts later illness and mortality, and because it captures physical and mental health together.
Jonah wrote down the hypotheses. Null: the proportion with fair or poor health is the same in food-secure and food-insecure households. Alternative (two-sided): the proportions differ. He also stated that a secondary question would examine whether the association increased with the severity of food insecurity.
Step 2: Write the analysis plan
Before opening the outcome data, Jonah wrote a one-page statistical analysis plan. It specified the exposure and outcome definitions; the covariates for adjustment (age, sex, household income in thirds and daily smoking), chosen because each plausibly influences both food insecurity and health; the primary analysis (logistic regression); the secondary trend analysis; how missing data would be handled; and the planned sensitivity analyses. Writing the plan first protects against the temptation to try many analyses and report the most striking, a practice sometimes called p-hacking or the garden of forking paths.
Dr. Osei questioned one choice. Income lies on a possible pathway: low income causes food insecurity, but it is not caused by food insecurity, so it is a confounder of the food insecurity-health relationship, not a mediator. Jonah drew a simple causal diagram to justify this and also noted that poor health can reduce income and cause food insecurity, a form of reverse causation that a cross-sectional survey cannot rule out. Both points went into the plan.
| Element | Decision in the plan |
|---|---|
| Outcome | Fair or poor self-rated health (binary) |
| Exposure | Food insecure (moderate or severe) vs secure; secondary: three levels |
| Covariates | Age (continuous, per 10 years), sex, income third, daily smoking |
| Descriptive | Table 1 by food security status |
| Crude analysis | Chi-square test; risk difference, risk ratio and odds ratio with 95 percent CIs |
| Adjusted analysis | Logistic regression; adjusted odds ratio with 95 percent CI |
| Secondary | Test for trend across secure, moderate and severe food insecurity |
| Missing data | Complete-case analysis if under 5 percent missing; report numbers excluded |
| Sensitivity | Repeat with survey weights; repeat excluding respondents with a long-term disability |
| Reporting | Suppress cells under 10; report absolute and relative measures |
Step 3: Clean and prepare the data
Jonah checked the variables named in the plan. Self-rated health had no missing values and all codes were within 1 to 5; he derived a binary outcome coding fair and poor as 1. Food security had been scored by the survey team from the 18 items; he confirmed the categories against the published scoring rules and found no inconsistencies. Age ranged from 18 to 94, as expected. Household income was missing for 24 respondents (2.0 percent), below the 5 percent threshold in the plan, so the adjusted model would use the 1,176 respondents with complete data. Jonah compared the 24 respondents with missing income with the rest and found they were similar in age and self-rated health, which made serious bias unlikely.
He recorded every step in a cleaning log, so that another analyst could reproduce the final file from the raw data. The log was also where he noted a decision not to merge moderate and severe food insecurity into a single group for the secondary analysis, even though the severe group was small, because the plan required them separately.
Step 4: Describe the data
The first table of the report described the respondents overall and by food security status.
| Characteristic | Food secure (n = 1,020) | Food insecure (n = 180) | Total (n = 1,200) |
|---|---|---|---|
| Age, years, mean (SD) | 49.8 (16.9) | 41.2 (14.3) | 48.5 (16.8) |
| Female, n (percent) | 525 (51.5) | 101 (56.1) | 626 (52.2) |
| Lowest income third, n (percent) | 270 (27.0) | 130 (73.9) | 400 (34.0) |
| Daily smoker, n (percent) | 112 (11.0) | 47 (26.1) | 159 (13.3) |
| Hypertension, n (percent) | 276 (27.1) | 36 (20.0) | 312 (26.0) |
| Fair or poor self-rated health, n (percent) | 153 (15.0) | 63 (35.0) | 216 (18.0) |
Table 2 tells a clear story before any test is run. Adults in food-insecure households were younger, much more often in the lowest income third, and more than twice as likely to smoke daily. They were also more than twice as likely to report fair or poor health. Two of these differences point to possible confounding: income and smoking are both associated with food insecurity and with poorer health. Age works the other way: food-insecure respondents were younger, and younger people generally report better health, so failing to adjust for age might actually understate the association. The lower prevalence of hypertension in the food-insecure group is probably explained by their younger age, a reminder that crude comparisons can mislead in either direction.
Step 5: Test and model
The crude association
Worked problem
Crude analysis of food insecurity and self-rated health
Of 180 food-insecure adults, 63 reported fair or poor health; of 1,020 food-secure adults, 153 did. Test the association and calculate the risk difference, risk ratio and odds ratio with 95 percent confidence intervals.
Show solution
- Proportions: 63/180 = 0.350 and 153/1,020 = 0.150.
- Expected counts under independence: food insecure and fair or poor, \(180 \times 216/1200 = 32.4\); the other expected counts are 147.6, 183.6 and 836.4. All exceed 5.
- Chi-square: \(\chi^2 = \sum (O - E)^2/E = 41.5\) with 1 df; p < 0.001.
- Risk difference: 0.350 − 0.150 = 0.200. SE = \(\sqrt{0.35 \times 0.65/180 + 0.15 \times 0.85/1020} = 0.0373\); 95 percent CI 0.127 to 0.273.
- Risk ratio: 0.350/0.150 = 2.33. SE of ln RR = \(\sqrt{1/63 - 1/180 + 1/153 - 1/1020} = 0.127\); 95 percent CI 1.82 to 2.99.
- Odds ratio: \((63 \times 867)/(117 \times 153) = 3.05\). SE of ln OR = \(\sqrt{1/63 + 1/117 + 1/153 + 1/867} = 0.179\); 95 percent CI 2.15 to 4.34.
Answer: Fair or poor health was reported by 35 percent of food-insecure adults and 15 percent of food-secure adults: 20 percentage points more (95 percent CI 12.7 to 27.3), a risk ratio of 2.33 (1.82 to 2.99), and an odds ratio of 3.05 (2.15 to 4.34). The association is very unlikely to be due to chance (χ² = 41.5, p < 0.001). Because the outcome is common, the odds ratio is noticeably larger than the risk ratio.
Severity: the test for trend
The secondary analysis split food insecurity into its two levels. Fair or poor health was reported by 15.0 percent of food-secure adults, 30.0 percent (33 of 110) of moderately food-insecure adults and 42.9 percent (30 of 70) of severely food-insecure adults. The 3 × 2 chi-square test gave \(\chi^2 = 46.3\) with 2 df, and the chi-square test for trend, which uses the ordering, gave \(\chi^2 = 46.2\) with 1 df (both p < 0.001). The steady increase with severity, a dose-response pattern, strengthens the case that the association is not an artefact, though it does not prove causation.
The adjusted association
Jonah then fitted the planned logistic regression with fair or poor health as the outcome and food insecurity, age (per 10 years), sex, income third and daily smoking as predictors, using the 1,176 respondents with complete data (213 with fair or poor health, well above the 10 events per variable guideline for six parameters). Figure 2 shows the key odds ratios.
After adjustment, food insecurity remained strongly associated with fair or poor health (adjusted OR 2.10, 95 percent CI 1.42 to 3.11). The odds ratio fell from 3.05 to 2.10, showing that part of the crude association was explained by income and smoking, even though adjustment for age would by itself have pushed it up. Low income and daily smoking were also independently associated with poorer self-rated health, while sex was not.
To make the adjusted result more meaningful for the board, Jonah calculated predicted probabilities from the model for a typical respondent, a 45-year-old non-smoking woman in the middle income third: about 11 percent if food secure and about 21 percent if food insecure. He also converted the adjusted odds ratio to an approximate risk ratio using the method from Lesson 10 with a baseline risk of 0.15: \(2.10/(1 - 0.15 + 0.15 \times 2.10) = 1.80\). Food insecurity was associated with roughly 1.8 times the risk of fair or poor health after adjustment.
Step 6: Check assumptions and robustness
Jonah checked that age was reasonably modelled as linear on the log odds scale by comparing the model with one using age groups; the fit was nearly identical. He tested a pre-specified interaction between food insecurity and sex; it was not significant (p = 0.47), and the plan did not call for others. The model’s c-statistic was 0.70, adequate for a model meant to estimate an adjusted association rather than to predict individuals.
The two planned sensitivity analyses asked whether the result depended on choices that could reasonably have been made differently. Using the survey weights and design-based standard errors gave an adjusted odds ratio of 2.20 (95 percent CI 1.40 to 3.46), very close to the unweighted result but with a slightly wider interval. Excluding the 96 respondents who reported a long-term disability, to reduce the possibility that poor health caused food insecurity rather than the reverse, gave an adjusted OR of 1.93 (1.25 to 2.98). The association was robust to both checks.
Step 7: Interpret and report
Interpretation and limitations
Jonah’s interpretation was careful about what the data could and could not show. The survey was cross-sectional, so it could not establish whether food insecurity preceded poor health; reverse causation was plausible, and the disability sensitivity analysis only partly addressed it. Confounding by unmeasured factors such as mental health conditions, housing and employment status was possible. Self-rated health and food insecurity were both self-reported, and people who feel unwell might also report hardship more readily. The survey had a response rate of 58 percent, and non-respondents may have differed from respondents. On the other side, the association was strong, showed a dose-response gradient, persisted after adjustment and sensitivity analyses, and is consistent with a substantial body of published research from Canada and elsewhere linking food insecurity to poorer physical and mental health.
Writing for decision makers
The briefing note for the board began with a plain-language summary, placed the numbers that mattered most at the top, and avoided jargon such as "odds ratio" in the opening paragraph.
"About 1 in 7 Kestrel Valley adults (15 percent) lives in a household that struggles to afford enough food. These adults are more than twice as likely to rate their health as fair or poor: 35 percent compared with 15 percent of other adults. The link remains after taking account of differences in age, income and smoking, and it is strongest in households with the most severe food insecurity, where 43 percent report fair or poor health. Because the survey measured everyone at one point in time, it cannot show that food insecurity causes poor health; poor health may also lead to food insecurity. Research elsewhere suggests both directions matter."
The technical appendix contained the analysis plan, Table 2, the full regression output, the sensitivity analyses and the limitations. The report followed the STROBE guideline (Strengthening the Reporting of Observational Studies in Epidemiology), a checklist of items that reports of observational studies should include, such as the setting, participants, variables, statistical methods, missing data and limitations. Trials follow the corresponding CONSORT statement.
Protecting confidentiality
Before release, Jonah checked every table against the unit’s small-cell rule: counts below 10 would be suppressed. When the board asked for results by postal area, several areas had fewer than 10 severely food-insecure respondents, so he combined areas into three larger zones. He also rounded published percentages to whole numbers in the public summary. These rules protect respondents from being identified, especially in small communities.
Lessons from the capstone
Looking back, several themes from the course stand out. The analysis began with a precise question and a written plan. Descriptive statistics revealed most of the story and flagged confounding before any model was fitted. Hypothesis tests answered a narrow question about chance, while effect measures and confidence intervals described the size and precision of the association. Regression adjusted for several confounders at once but could not remove the limits of a cross-sectional design. Sensitivity analyses tested whether conclusions depended on particular choices. And the final step, communicating clearly and honestly, determined whether the work would be used.
The board voted to fund a pilot partnership between the food bank and primary care clinics to screen for food insecurity and connect patients with income and food supports, and asked the public health unit to evaluate it. Designing that evaluation, with a comparison group and a pre-specified outcome, would draw on the same statistical toolkit, and on the program evaluation methods covered elsewhere in the public health curriculum.
Common mistakes
MistakeRunning analyses first and deciding afterwards which to report.
InsteadWrite and follow an analysis plan; label any unplanned analyses as exploratory.
MistakeTreating a cross-sectional association as proof of cause.
InsteadDiscuss temporality, reverse causation, confounding and bias, and use cautious language.
MistakeReporting only the adjusted odds ratio to a lay audience.
InsteadLead with proportions and absolute differences; provide technical measures in an appendix.
MistakeIgnoring survey weights and design.
InsteadUse weights and design-based variance, at least as a sensitivity analysis, when analysing complex surveys.
MistakePublishing small cells for small areas.
InsteadApply small-cell suppression and aggregation rules before release.
Summary and key terms
- A good analysis starts with a precise question defining the population, exposure, comparison and outcome, and a written analysis plan.
- Data cleaning and a documented log make the analysis reproducible; report and examine missing data.
- A descriptive Table 1 by exposure group reveals the main pattern and possible confounders.
- Crude analyses combine a test with absolute and relative effect measures and their confidence intervals; trend tests examine dose-response.
- Regression adjusts for several confounders; predicted probabilities and approximate risk ratios help communicate odds ratios.
- Assumption checks and sensitivity analyses test robustness; limitations of the design must be stated plainly.
- Reports for decision makers lead with plain language and absolute numbers, follow reporting guidelines and protect confidentiality.
- Statistical analysis plan
- A document, written before analysis, specifying the questions, variables, methods and handling of missing data.
- p-hacking
- Trying many analyses and selectively reporting those with significant results.
- Dose-response
- A pattern in which the outcome changes steadily with the level of exposure.
- Sensitivity analysis
- Repeating an analysis under different reasonable assumptions to see whether conclusions change.
- STROBE
- A reporting guideline for observational studies in epidemiology.
- Reverse causation
- A situation in which the outcome influences the exposure rather than the reverse.
- Small-cell suppression
- Withholding counts below a threshold to protect confidentiality.
- Cleaning log
- A record of every change made to raw data during preparation.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Using Table 2, explain in one sentence why adjusting for age could increase the odds ratio for food insecurity while adjusting for income decreases it.
Show answer
Food-insecure adults are younger (and younger people report better health), so age masks the association, whereas they are poorer (and low income is linked to poor health), so income inflates it.
The board asks for the number of severely food-insecure adults with poor health in each of 12 postal areas. What should Jonah do?
Show answer
Check counts against the small-cell rule; most areas would have fewer than 10, so he should aggregate areas into larger zones or suppress the cells.
Propose one additional sensitivity analysis Jonah could have planned and explain what it would test.
Show answer
For example, multiple imputation for missing income (to test whether complete-case analysis biased results), or adjusting for a mental health measure (to test confounding by mental health).
Rewrite this sentence for the public: "The adjusted OR for food insecurity was 2.10 (95 percent CI 1.42 to 3.11)."
Show answer
For example: "Even among adults of similar age, income and smoking habits, those who struggle to afford food are about twice as likely to say their health is only fair or poor."
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.