In this lecture, we ask a simple causal question:
Is the risk of cardiovascular disease (CVD) different for smokers and non-smokers?
Here, CVD means a person reported at least one of the following: congestive heart failure, coronary heart disease, angina, heart attack, or stroke.
In this dataset, smoker means a person reported that they had smoked at least 100 cigarettes in their life. So this is not exactly the same as “currently smokes every day.” It is a simple lifetime smoking measure.
We will use the word risk in a classroom-friendly way: the percent of people in the dataset who had CVD before the interview.
We will use the NHANES classroom dataset. To keep the first lecture simple, we will not use survey weights. That means our results describe the people in this classroom dataset, not a perfectly weighted estimate for the whole United States.
The picture shows the basic story we want to study: smoking happens before the health outcome, and we want to know whether changing smoking would change CVD risk.
Suppose we see that smokers have more CVD than non-smokers.
Can we immediately say smoking caused the difference?
Not quite.
Smokers and non-smokers might differ in many ways besides smoking. For example, they might have different ages, diets, exercise habits, medical histories, or income levels. These other differences can make a simple comparison unfair.
Still, a simple comparison is a great place to start. It helps us see the main idea before we learn more advanced methods.
Here is a cartoon example. On a hot sunny day, people may buy more ice cream and also get more sunburn. Ice cream and sunburn can be correlated, but eating ice cream is not what caused the sunburn.
So the key difference is:
Correlation means two things tend to appear together. Causation means changing one thing would change the other.
Causal inference starts with a very important imagination exercise.
For each person, imagine two possible outcomes:
| Symbol | Meaning |
|---|---|
Y(1) |
The person’s CVD outcome if the person smoked |
Y(0) |
The person’s CVD outcome if the person did not smoke |
For a single person, the causal effect of smoking would be:
Causal effect for one person = Y(1) - Y(0)
If Y(1) = 1 and Y(0) = 0, then smoking
would change that person’s outcome from no CVD to CVD.
If Y(1) = 0 and Y(0) = 0, then that person
would not have CVD either way.
The hard part is that we cannot observe both possible worlds for the same person.
Imagine three students: Alex, Tom, and Jane.
| Person | If smoker: Y(1) |
If non-smoker: Y(0) |
What do we actually observe? |
|---|---|---|---|
| Alex | ? | ? | If Alex smoked, we observe only Y(1) |
| Tom | ? | ? | If Tom did not smoke, we observe only
Y(0) |
| Jane | ? | ? | If Jane smoked, we observe only Y(1) |
If Alex or Jane smoked, we can observe their outcomes as smokers. But we cannot rewind life and also observe them as non-smokers.
If Tom did not smoke, we can observe Tom’s outcome as a non-smoker. But we cannot rewind life and also observe Tom as a smoker.
This is called the fundamental problem of causal inference:
For the same person, at the same time, we can observe only one potential outcome.
Because we cannot compare Alex to Alex, Tom to Tom, or Jane to Jane in two possible worlds, we compare groups of people instead.
Our simple method is:
The observed risk difference is:
Risk among smokers - Risk among non-smokers
This is easy to understand, but we should be careful with words.
This number is an observed difference. It becomes a causal estimate only if the smoker and non-smoker groups are comparable enough that smoking is the main important difference between them.
data_path <- file.path("..", "Data", "NHANES_data.csv")
if (!file.exists(data_path)) {
data_path <- file.path("Data", "NHANES_data.csv")
}
nhanes <- read.csv(data_path, stringsAsFactors = FALSE)
analysis_data <- subset(
nhanes,
!is.na(smoker_indicator) & !is.na(cvd_indicator)
)
analysis_data$smoking_group <- ifelse(
analysis_data$smoker_indicator == 1,
"Smoker",
"Non-smoker"
)
analysis_data$cvd_status <- ifelse(
analysis_data$cvd_indicator == 1,
"Had CVD",
"No CVD"
)
nrow(analysis_data)
## [1] 8349
The last line shows how many people have both smoking information and CVD information available.
count_table <- with(analysis_data, table(smoking_group, cvd_status))
count_table <- count_table[, c("No CVD", "Had CVD")]
knitr::kable(
addmargins(count_table),
caption = "Number of people with and without CVD by smoking group"
)
| No CVD | Had CVD | Sum | |
|---|---|---|---|
| Non-smoker | 4583 | 344 | 4927 |
| Smoker | 2900 | 522 | 3422 |
| Sum | 7483 | 866 | 8349 |
This table gives the raw counts. Now we turn the counts into percentages.
groups <- split(analysis_data$cvd_indicator, analysis_data$smoking_group)
risk_summary <- data.frame(
smoking_group = names(groups),
number_of_people = as.integer(sapply(groups, length)),
number_with_cvd = as.integer(sapply(groups, sum)),
cvd_risk = as.numeric(sapply(groups, mean))
)
risk_summary <- risk_summary[
match(c("Non-smoker", "Smoker"), risk_summary$smoking_group),
]
risk_summary$cvd_risk_percent <- round(100 * risk_summary$cvd_risk, 1)
knitr::kable(
risk_summary[, c(
"smoking_group",
"number_of_people",
"number_with_cvd",
"cvd_risk_percent"
)],
col.names = c("Group", "Number of people", "Number with CVD", "CVD risk (%)"),
caption = "Observed CVD risk by smoking group"
)
| Group | Number of people | Number with CVD | CVD risk (%) |
|---|---|---|---|
| Non-smoker | 4927 | 344 | 7.0 |
| Smoker | 3422 | 522 | 15.3 |
risk_non_smoker <- risk_summary$cvd_risk[
risk_summary$smoking_group == "Non-smoker"
]
risk_smoker <- risk_summary$cvd_risk[
risk_summary$smoking_group == "Smoker"
]
risk_difference <- risk_smoker - risk_non_smoker
risk_ratio <- risk_smoker / risk_non_smoker
cat(
"Observed risk among non-smokers:",
round(100 * risk_non_smoker, 1),
"%\n"
)
## Observed risk among non-smokers: 7 %
cat(
"Observed risk among smokers:",
round(100 * risk_smoker, 1),
"%\n"
)
## Observed risk among smokers: 15.3 %
cat(
"Observed risk difference:",
round(100 * risk_difference, 1),
"percentage points\n"
)
## Observed risk difference: 8.3 percentage points
cat(
"Observed risk ratio:",
round(risk_ratio, 2),
"\n"
)
## Observed risk ratio: 2.18
In this dataset, the observed CVD risk is higher among smokers than non-smokers.
The risk difference tells us the gap in percentage points. The risk ratio tells us how many times larger the smoker group’s observed risk is compared with the non-smoker group’s observed risk.
First, imagine 100 people from each group. Red dots represent people with CVD. Green dots represent people without CVD.
This picture turns percentages into something more concrete. Out of 100 similar-looking dots, about 7 non-smoker dots are red and about 15 smoker dots are red.
risk_percent <- setNames(
100 * risk_summary$cvd_risk,
risk_summary$smoking_group
)
bar_locations <- barplot(
risk_percent,
ylim = c(0, max(risk_percent) * 1.25),
col = c("#4E79A7", "#F28E2B"),
ylab = "Percent with CVD",
main = "Observed CVD Risk by Smoking Group"
)
text(
x = bar_locations,
y = risk_percent + 1,
labels = paste0(round(risk_percent, 1), "%")
)
The bar plot makes the comparison easier to see: the smoker group has a larger observed percentage with CVD.
The simple comparison is useful, but the smoker and non-smoker groups may differ in other ways.
This is why we say the simple result is an observed difference. Later methods will try to compare smokers and non-smokers who are more similar on other important variables.
From this simple analysis, we can say:
In this classroom NHANES dataset, smokers had a higher observed CVD risk than non-smokers.
More specifically, the observed CVD risk was 7% for non-smokers and 15.3% for smokers. The observed difference was 8.3 percentage points.
But we should not overclaim.
This simple comparison does not prove by itself that smoking caused the entire difference. It does not adjust for age, sex, race, income, hypertension, or other possible differences between smokers and non-smokers.
It also uses a simple lifetime smoking variable and does not check exact timing between smoking and CVD. That is another reason to treat this as a first classroom example, not the final scientific answer.
The causal inference idea is:
We want to compare what would happen under smoking with what would happen under no smoking.
The simple analysis is our first step. Later, we can learn methods that try to make the smoker and non-smoker groups more comparable.
This lecture used the central idea behind Rubin’s potential outcome framework, also called the Rubin causal model.
The framework starts with one simple question:
What would happen to the same person under different treatment choices?
In our example, the treatment is smoking status and the outcome is CVD.
For person \(i\), define:
\[ T_i = \begin{cases} 1, & \text{if person } i \text{ is a smoker},\\ 0, & \text{if person } i \text{ is a non-smoker}. \end{cases} \]
Also define the observed CVD outcome:
\[ Y_i = \begin{cases} 1, & \text{if person } i \text{ has CVD},\\ 0, & \text{if person } i \text{ does not have CVD}. \end{cases} \]
The potential outcomes are:
\[ Y_i(1) = \text{CVD outcome if person } i \text{ smoked}, \]
and
\[ Y_i(0) = \text{CVD outcome if person } i \text{ did not smoke}. \]
So each person has two possible outcomes in our imagination:
\[ \{Y_i(1), Y_i(0)\}. \]
For one person, the causal effect of smoking would be:
\[ \tau_i = Y_i(1) - Y_i(0). \]
For example, if:
\[ Y_i(1) = 1 \quad \text{and} \quad Y_i(0) = 0, \]
then smoking would change this person’s CVD outcome from no CVD to CVD.
But there is a problem. We cannot observe both \(Y_i(1)\) and \(Y_i(0)\) for the same person.
If person \(i\) smoked, we observe \(Y_i(1)\), but \(Y_i(0)\) is missing. If person \(i\) did not smoke, we observe \(Y_i(0)\), but \(Y_i(1)\) is missing.
This is the fundamental problem of causal inference.
Rubin’s framework writes the observed outcome as:
\[ Y_i = T_iY_i(1) + (1 - T_i)Y_i(0). \]
This formula says:
So the observed outcome is the potential outcome from the world the person actually lived in.
Because we cannot see both outcomes for the same person, we usually talk about an average causal effect in a population.
The average treatment effect is:
\[ ATE = E\{Y(1) - Y(0)\}. \]
This can also be written as:
\[ ATE = E\{Y(1)\} - E\{Y(0)\}. \]
In words:
The causal risk difference compares the average CVD risk if everyone smoked with the average CVD risk if everyone did not smoke.
That is the causal quantity we would like to know.
Lecture 1 calculates the observed risk among smokers:
\[ \hat P(Y = 1 \mid T = 1) = \frac{\sum_{i=1}^{n} T_iY_i} {\sum_{i=1}^{n} T_i}, \]
and the observed risk among non-smokers:
\[ \hat P(Y = 1 \mid T = 0) = \frac{\sum_{i=1}^{n} (1 - T_i)Y_i} {\sum_{i=1}^{n} (1 - T_i)}. \]
The observed risk difference is:
\[ \widehat{RD}_{obs} = \hat P(Y = 1 \mid T = 1) - \hat P(Y = 1 \mid T = 0). \]
The observed risk ratio is:
\[ \widehat{RR}_{obs} = \frac{\hat P(Y = 1 \mid T = 1)} {\hat P(Y = 1 \mid T = 0)}. \]
These are the simple classroom estimates used in this lecture.
The observed comparison becomes a causal comparison only under strong assumptions.
The most important idea is exchangeability:
\[ \{Y_i(1), Y_i(0)\} \perp T_i. \]
This means:
The smoker and non-smoker groups are comparable in the outcomes they would have had under either choice.
In a randomized experiment, exchangeability is created by random assignment. In this observational NHANES example, people chose or experienced smoking status in real life, so exchangeability is not guaranteed.
We also need:
That is why Lecture 1 says the simple result is an observed association. Later lectures use IPW, outcome regression, and doubly robust methods to make the comparison more fair using measured baseline covariates.
Holland, P. W. (1986). Statistics and causal inference. Journal of the American Statistical Association, 81(396), 945-960.
Imbens, G. W., & Rubin, D. B. (2015). Causal Inference for Statistics, Social, and Biomedical Sciences: An Introduction. Cambridge University Press.
Neyman, J. (1990). On the application of probability theory to agricultural experiments. Essay on principles. Section 9. Statistical Science, 5(4), 465-472. Originally published 1923.
Rubin, D. B. (1974). Estimating causal effects of treatments in randomized and nonrandomized studies. Journal of Educational Psychology, 66(5), 688-701.