Influenza data were collected in a suburban city among adult population aged 18–70. Participants were monitored from October 1, 2019 – March 1, 2020 (covering the typical U.S. flu season; ~120 days). At enrollment, participants were tested using PCR to determine: whether they had current influenza infection → disease. Throughout the flu season, participants reported symptoms weekly through an online portal, received testing if symptomatic. They could become new cases if the tested positive. They continued contributing to the study until they developed the flu, dropped out, or the flu season ended
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Calculate prevalence of the “disease” variable
This means that 2.4% of people had influenza at enrollment.
Calculate cumulative incidence of new cases
::: {.cell}
```{.r .cell-code}
influenza_data |> summarize(
ci_risk= sum(influenza_data$new_case==1)/nrow(influenza_data)
)
```
::: {.cell-output .cell-output-stdout}
```
ci_risk
1 0.11
```
:::
:::
The risk of someone getting the flu over the study period is 11%.
There is an incidence rate of 4.439013 per 10 person-years for influenza.
Part 2 — Measures of Association
Data were collected to determine the relationship of GI disease in the community. After multiple reports of acute gastroenteritis in the community, the local health department launched an investigation to see whether drinking untreated water increased the risk of GI illness.
Design: Short-term prospective cohort
Sample size: n=600 residents
Follow-up: ~3–5 weeks during a suspected contamination episode
Residents were enrolled and completed a baseline survey:
Source of most drinking water in the last month:
- Untreated (private well, spring, surface water, or unfiltered tap) → exposed_untreated = 1
- Treated (municipal treated water, filtered, or bottled) → exposed_untreated = 0
Participants were then followed for 20–40 days, during which they reported:
Onset of acute GI symptoms
Duration of follow-up (censoring if they moved, were hospitalized, or stopped responding)
Any participant meeting the GI case definition during follow-up was coded as:
outcome_gi = 1 (incident GI illness)
outcome_gi = 0 (no GI symptoms during their follow-up time)