In epidemiology, measuring disease frequency is the first step in the “Epidemiologic Cycle.” We move from anecdotal evidence (e.g., “there seems to be a lot of flu”) to quantitative data (e.g., “the incidence is 5 per 1,000 person-years”).
There are three fundamental ways to express the relationship between a numerator (\(x\)) and a denominator (\(y\)).
| Type | Definition | Example |
|---|---|---|
| Ratio | \(x\) is not part of \(y\) | 5 males : 10 females |
| Proportion | \(x\) is a part of \(y\) | 5 cases / 100 people (5%) |
| Rate | Proportion + Time element | 5 cases per 1,000 people per year |
Prevalence measures the total number of cases (old and new) in a population at a specific point in time.
Formula: \[P = \frac{\text{Number of existing cases}}{\text{Total Population}} \times 10^n\]
In a country with 1,000,000 people, if 50,000 people are currently living with HIV, the prevalence is \(5\%\). Prevalence is useful for resource planning (e.g., how many hospital beds or doses of medication are needed today).
Incidence measures the flow of new cases into a population.
The probability that an individual will develop the disease over a specific period. \[CI = \frac{\text{New cases during period}}{\text{Population at risk at the start}}\]
Used when people are followed for different amounts of time. \[IR = \frac{\text{New cases}}{\text{Sum of person-time units}}\]
The relationship between Incidence and Prevalence is often described using the “Bathtub Analogy.”
Scenario: A Flu Outbreak in a Nursing Home
| Measure | Numerator | Denominator | Utility |
|---|---|---|---|
| Prevalence | All cases | Total population | Planning / Burden |
| Incidence | New cases | Population at risk | Etiology / Risk |
| Case Fatality | Deaths from disease | Total cases | Disease Severity |
A community of 10,000 people is monitored for “Disease X” over one year. - At the start, 500 have it. - During the year, 200 new cases are diagnosed. - 50 people die from the disease.
Task: Calculate the Period Prevalence and the Cumulative Incidence using R.
pop <- 10000
existing <- 500
new_cases <- 200
# Calculate
period_prevalence <- ((existing + new_cases) / pop) * 100
cum_incidence <- (new_cases / (pop - existing)) * 1000
print(paste("Period Prevalence:", period_prevalence, "%"))## [1] "Period Prevalence: 7 %"
## [1] "Cumulative Incidence: 21.05 per 1,000 at risk"
```
In R, :: allows you to access a function from a package
without loading it. However, opts_chunk is not a function;
it is a list (specifically an internal object) within
the knitr package.
knitr::opts_chunk_set() (R
looks for a function named exactly that and fails).knitr::opts_chunk$set() (R
finds the list opts_chunk and then uses the $
to call the set function inside it).