Your father’s lightsaber. This is the weapon of a Jedi knight. Not as clumsy and random as a blaster. An elegant weapon for a more civilized age. (Obi-Wan Kenobi, Star Wars, 1977)1
Potential outcomes, directed acyclic graphs (DAGs), and single-world intervention graphs (SWIGs) have greatly clarified thinking about causal inference in epidemiology as well as other social and natural sciences. The causal effect of a binary exposure \(X\) on a disease outcome \(D\) is the change in the risk of \(D\) caused by intervening to change exposure from \(X = 0\) to \(X = 1\). This definition matches the effect estimated in a randomized trial, which estimates the effect of a change in exposure on the risk of disease in the population eligible for the trial. In a large randomized study, the treatment and control groups are both representative of the eligible population.
When there is confounding and selection bias, it is possible that neither exposure group is representative of the eligible population. If we can identify a set \(C\) of covariates that can be used to control confounding and selection bias, we can calculate causal effects within strata defined by \(C\). However, we can combine these conditional causal effects into marginal causal effects through an elegant process called standardization, which is the lightsaber of causal inference (where regression models are blasters).
17.1 Measures of association in a cohort study with bias
The key idea in causal inference is that there is a fundamental difference between observation and intervention. Let \(X\) be a binary exposure, \(D\) be a binary disease outcome, \(C\) be a discrete confounder, and \(S\) denote selection into the study. For simplicity, we assume that \(X\) does not change over time. The occurrence of \(D\) is measured over a time interval \((0, t]\). Using these data, we can calculate crude measures of association or measures of association conditional on \(C\).
17.1.1 Confounding and selection bias
Figure 17.1 shows a simple DAG for a cohort study with confounding, selection bias, and a causal effect of \(X\) on \(D\). There is confounding because of the open backdoor path \(X \leftarrow C \rightarrow D\). There is selection bias because the noncausal path \(X \rightarrow S \leftarrow X \rightarrow D\) is opened by conditioning on the collider at \(S\). The analytic case-control condition fails because of the path \(X \rightarrow S\), and there is no way to close this. The confounding and selection bias occur whether or not there is a causal effect of \(X\) on \(D\), which is represented by the path \(X \rightarrow D\).
Code
dag-cxsd.R
# DAG for cohort study with confounding and selection bias# load R packageslibrary(dagitty)library(ggdag, warn.conflicts =FALSE)library(ggplot2)# define the DAGcohort <-dagitty('dag{ C -> D C -> S C -> X X -> D X -> S}')# generate data for plotting DAG using ggplot()# Use geom_dag_label() for adjusted variables to get a box around them.coordinates(cohort) <-list(x =c(C =0, X =1, S =1.5, D =2),y =c(C =0, X =0, S =-0.3, D =0))cohort_dat <-control_for(cohort, "S", activate_colliders =FALSE)cohort_adj <-filter(cohort_dat, adjusted =="adjusted")cohort_unadj <-filter(cohort_dat, adjusted =="unadjusted")# plot DAG with ggplot() to allow for boxes and curved arrows(ggplot(cohort_dat, aes(x = x, y = y, xend = xend, yend = yend))+theme_dag_gray_grid()+coord_equal()+ylim(-0.4, 0.3)+geom_dag_label(data = cohort_adj,parse =TRUE, size =8, fill =NA,label.padding =unit(0.15, "lines"))+geom_dag_text(data = cohort_unadj, parse =TRUE,color ="black", size =8)+geom_dag_edges_arc(curvature =c(0.2, -0.13, 0, 0, 0)))
Figure 17.1: Directed acyclic graph (DAG) showing a cohort study with confounding, selection bias, and a causal effect of \(X\) on \(D\).
If we condition on \(C\) in Figure 17.1, this closes both the backdoor path from \(X\) to \(D\) as well as the noncausal path from \(X\) to \(D\) that was opened by conditioning on \(S\). Figure 17.2 shows the single-world intervention graph (SWIG) corresponding to an intervention that sets \(X = x\), which has a box around \(C\) to represent conditioning on it. There is also a box around little \(x\) to show that the path \(S^x \leftarrow x \rightarrow D^x\) is closed because it \(x\) represents a fixed hypothetical value of \(X\). However, \(x\) is not a variable that we can measure and condition on when we analyze the data. The SWIG shows that measuring \(C\) and conditioning on it is sufficient to control both:
We have exchangeability \(D^x \indep X \given{} C\) because \(D^x\) and big \(X\) (which represents the actual or realized exposure status) are d-separated given \(C\), which is a non-descendant of \(X\).
We have the analytic cohort condition \(S^x \indep D^x \given{} (X, C)\) because \(S^x\) and \(D^x\) are d-separated given big \(X\) and \(C\), which is a nondescendant of \(X\). The paths through little \(x\) are closed, but we do not include \(x\) in the conditional independence statements.
Code
swig-cxsd.R
# DAG for cohort study with confounding and selection bias# load R packageslibrary(dagitty)library(ggdag, warn.conflicts =FALSE)library(ggplot2)# define the DAGcohort <-dagitty('dag{ C -> D C -> S C -> X x -> D x -> S}')# generate data for plotting DAG using ggplot()# Use geom_dag_label() for adjusted variables to get a box around them.coordinates(cohort) <-list(x =c(C =0, X =0.9, x =1.1, S =2, D =3),y =c(C =0, X =0, x =0, S =-0.5, D =0))cohort_dat <-control_for(cohort, c("C", "x"), activate_colliders =FALSE)label(cohort_dat) <-c("C"="C", "X"="X", "x"="x","D"="D^x", "S"="S^x")cohort_adj <-filter(cohort_dat, adjusted =="adjusted")cohort_unadj <-filter(cohort_dat, adjusted =="unadjusted")# plot DAG with ggplot() to allow for boxes and curved arrows(ggplot(cohort_dat, aes(x = x, y = y, xend = xend, yend = yend))+theme_dag_gray_grid()+coord_equal()+geom_dag_label(data = cohort_adj, parse =TRUE, size =8, fill =NA,label.padding =unit(0.15, "lines"))+geom_dag_text(aes(label = label), data = cohort_unadj, parse =TRUE,color ="black", size =8)+geom_dag_edges_arc(curvature =c(0.25, -0.15, 0, 0, 0))+annotate("text", x =1, y =0.01, size =8, label ="|"))
Figure 17.2: Single-world intervention graph (SWIG) for setting \(X = x\) in the DAG from Figure 17.1. The box around \(C\) indicates conditioning on \(C\), and the box around little \(x\) shows that paths through it are closed.
17.1.2 Crude measures
A crude measure of association is a comparison of the risks of disease in the exposed and unexposed in the study sample. The crude risk difference is \[
\RD_\crude
= \Pr(D = 1 \given{} X = 1, S = 1) - \Pr(D = 1 \given{} X = 0, S = 1),
\tag{17.1}\] the crude risk ratio is \[
\RR_\text{crude}
= \frac{\Pr(D = 1 \given{} X = 1, S = 1)}{\Pr(D = 1 \given{} X = 0, S = 1)},
\tag{17.2}\] the crude odds ratio is \[
\OR_\text{crude}
= \frac{\odds\bigl(\Pr(D = 1 \given{} X = 1, S = 1)\bigr)}
{\odds\bigl(\Pr(D = 0 \given{} X = 0, S = 1)\bigr)},
\tag{17.3}\] and the crude cumulative hazard ratio is \[
\CHR_\crude
= \frac{-\ln\bigl(1 - \Pr(D = 1 \given{} X = 1, S = 1)\bigr)}
{-\ln\bigl(1 - \Pr(D = 1 \given{} X = 0, S = 1)\bigr)}.
\] These are measures of association, which do not necessarily represent causal effects.
17.1.3 Marginal causal effects
When we have no confounding and no selection bias, \[
\begin{aligned}
\Pr(D^x = 1)
&= \Pr(D^x = 1 \given{} X = x) &&\text{by exchangeability} \\
&= \Pr(D^x = 1 \given{} X = x, S^x = 1) &&\text{by the analytic cohort condition} \\
&= \Pr(D = 1 \given{} X = x, S = 1) &&\text{by consistency}.
\end{aligned}
\tag{17.4}\] Thus, the estimated risk in each exposure group is an unbiased estimate of the marginal causal risk under the same exposure in the eligible population. Therefore,each crude measure of association is a consistent estimator of a marginal causal effect, which is a measure of association that compares \(\Pr(D^1 = 1)\) to \(\Pr(D^0 = 1)\). In terms of a hypothetical experiment, this is the causal effect we would see if we compared the entire eligible population under an intervention that set \(X = 1\) to itself under an intervention that set \(X = 0\).
In a study represented by the DAG in Figure 17.1, the first equality in Equation 17.4 fails because of confounding and the second equality fails because of selection bias. If there is confounding or selection bias, the crude measures of association do not represent marginal causal effects.
When there is confounding, part of the difference in risk captured by the crude measures of association is due to different distributions of \(C\) in the exposed and unexposed. In the DAG in Figure 17.1, the open path between \(C\) and \(X\) means that we can have \[
\Pr(C = c \given{} X = 1)
\neq \Pr(C = c \given{} X = 0),
\] so the distribution of \(C\) is different in the exposed and unexposed groups. Because of the open path between \(C\) and \(D\), the risk of disease can depend on \(C\). Thus, the different distributions of \(C\) would cause a difference in risk even if \(X\) had no causal effect on \(D\). When we add selection bias, the situation deteriorates further.
17.1.4 Stratum-specific measures
A stratum-specific measure of association is a comparison of the risks of disease in the exposed and unexposed in the subset of the study with tje same value of covariates \(C = c\). A stratum can also be defined by multiple covariates at the same time, in which case we let \(C\) represent the set of covariates and \(c\) a vector of values of these covariates (e.g., \(C_1 = c_1\), …, \(C_k = c_k\)). In both cases, the stratum-specific risk difference given \(C = c\) is \[
RD_{C = c}
= \Pr(D = 1 \given{} C = c, X = 1, S = 1) - \Pr(D = 1 \given{} C = c, X = 0, S = 1),
\tag{17.5}\] the crude risk ratio is \[
\RR_\text{C = c}
= \frac{\Pr(D = 1 \given{} C = c, X = 1, S = 1)}{\Pr(D = 1 \given{} C = c, X = 0, S = 1)},
\tag{17.6}\] the crude odds ratio is \[
\OR_\text{C = c}
= \frac{\odds\bigl(\Pr(D = 1 \given{} C = c, X = 1, S = 1)\bigr)}
{\odds\bigl(\Pr(D = 0 \given{} C = c, X = 0, S = 1)\bigr)},
\tag{17.7}\] and the crude cumulative hazard ratio is \[
\CHR_{C = c}
= \frac{-\ln\bigl(1 - \Pr(D = 1 \given{} C = c, X = 1, S = 1)\bigr)}
{-\ln\bigl(1 - \Pr(D = 1 \given{} C = c, X = 0, S = 1)\bigr)}.
\] As with crude measures of association, these do not necessarily represent causal effects.
17.1.5 Conditional causal effects
When we have no confounding and no selection bias given \(C\), as in a study represented by the DAG in Figure 17.1, then \[
\begin{aligned}
&\Pr(D^x = 1 \given{} C = c) \\
&\qquad = \Pr(D^x = 1 \given{} C = c, X = x) &&\text{by exchangeability given } C \\
&\qquad = \Pr(D^x = 1 \given{} C = c, X = x, S^x = 1) &&\text{by the analytic cohort condition} \\
&\qquad = \Pr(D = 1 \given{} C = c, X = x, S = 1) &&\text{by consistency.}
\end{aligned}
\tag{17.8}\] Thus, the estimated conditional risk given \(C = c\) in each exposure group is an unbiased estimate of the causal conditional risk given \(C = c\) in the eligible subpopulation if we intervene to set the same exposure. Therefore, each conditional measure of association is a consistent estimator of a conditional causal effect, which is a measure of association that compares \(\Pr(D^1 = 1 \given{} C = c)\) to \(\Pr(D^0 = 1 \given{} C = c)\). In terms of a hypothetical experiment, this is the causal effect we would see if we compared the entire eligible subpopulation with \(C = c\) under an intervention that set \(X = 1\) to itself under an intervention that set \(X = 0\).
In a study represented by the DAG in Figure 17.1, both equalities in Equation 17.8 hold because conditioning on \(C\) controls confounding and selection bias. If there is residual confounding or selection bias after conditioning on \(C\), at least one of the stratum-specific measures of association does not represent a conditional causal effect. This could happen, for example, if there are common causes of two or more variables on the DAG that are not included. In practice, there is always residual confounding and selection bias. Our goal in study design and analysis is to reduce these to the point that the remaning bias is small compared to the causal effect of \(X\) on \(D\) that we are looking for.
17.2 Standardization
The basic idea behind standardization is to calculate the risk of disease in hypothetical exposed and unexposed population with the same distribution of \(C\). If conditioning on \(C\) controls confounding and selection bias, then a measure of association that compares these standardized risks can be interpreted as a measure of a marginal causal effect. The distribution of \(C\) used to calculate \(\Pr(D^x = 1)\) is less important that the fact that the same distribution is used for both exposure groups.
17.2.1 Reconstructing marginal causal risks
Imagine that we intervene to set \(X = x\) for the entire population. Then the risk of disease would be \[
\Pr(D^x = 1) = \sum_c \Pr(D^x \given{} C = c) \Pr(C = c),
\tag{17.9}\] where the sum is over all possible values \(c\) of \(C\) in the population. When conditioning on \(C\) controls confounding and selection bias as in Equation 17.8, then \[
\Pr(D^x = 1)
= \sum_c \Pr(D = 1 \given{} C = c, X = x, S = 1) \Pr(C = c).
\] Thus, the we can estimate the marginal causal risks \(\Pr(D^1 = 1)\) and \(\Pr(D^0 = 1)\) using data from our study sample and the distribution of \(C\) in the population.
Unfortunately, the distribution of \(C\) in the population often cannot be recovered from our study sample. In the study represented by the DAG in Figure 17.1, the open paths \(C \rightarrow X \rightarrow S\) and \(C \rightarrow S\) mean that \[
\Pr(C = c \given{} S = 1) \neq \Pr(C = c),
\] so we cannot get \(\Pr(C = c)\) without data external to the study. This is not selection bias because it does not prevent us from getting an unbiased estimate of \(\Pr(D^x = 1 \given{} C = c)\).
17.2.2 Standardized risks and measures of association
To standarize, we choose a distribution of \(C\) calculate what the marginal risks in the exposed and unexposed would be if they both had this distribution of \(C\). Let the probability that \(C = c\) in our standard population be \[
\Prstd(C = c).
\] The corresponding standardized risk given \(X = x\) based on data from our study sample is \[
\Prstd(D = 1 \given{} X = x, S = 1)
= \sum_{c} p_{xc} \Prstd(C = c),
\] where \[
p_{xc} = \Pr(D = 1 \given{} C = c, X = x, S = 1).
\] To calculate a standardized estimate, we need each possible value of \(C\) in the standard population to be represented in the study sample.
Because the same distribution of \(C\) is used for both exposure groups and there is no causal effect of \(X\) on \(C\), any measure of association that compares \(\Pr_\std(D = 1 \given{} X = 1, S = 1)\) and \(\Pr_\std(D = 1 \given{} X = 0, S = 1)\) represents a marginal causal effect in our standard population. The standardized risk difference is \[
\RD_\std
= \Prstd(D = 1 \given{} X = 1, S = 1) - \Prstd(D = 1 \given{} X = 0, S = 1),
\tag{17.10}\] the standardized risk ratio is \[
\RR_\std
= \frac{\Prstd(D = 1 \given{} X = 1, S = 1)}{\Prstd(D = 1 \given{} X = 0, S = 1)},
\tag{17.11}\] the standardized odds ratio is \[
\OR_\std
= \frac{\odds\bigl(\Prstd(D = 1 \given{} X = 1, S = 1)\bigr)}
{\odds\bigl(\Prstd(D = 0 \given{} X = 0, S = 1)\bigr)},
\tag{17.12}\] and the standardized cumulative hazard ratio is \[
\CHR_\std
= \frac{-\ln\bigl(1 - \Prstd(D = 1 \given{} X = 1, S = 1)\bigr)}
{-\ln\bigl(1 - \Prstd(D = 1 \given{} X = 0, S = 1)\bigr)}.
\tag{17.13}\] When conditioning on \(C\) controls confounding and selection bias, these represent marginal causal effects in the standard population. For some distribution of \(C\), they would represent marginal causal effects in the eligible population. However, we may or may not be able to estimate this distribution of \(C\) using our study sample.
17.2.3 Treatment effects
Using only data from the study sample, we have three standard choices for a standard population: the entire study sample, the exposed or treated, and the unexposed or controls. When there is no confounding or selection bias, we can use our study sample to estimate the marginal distribution of \(C\) and the conditional distributions of \(C\) given \(X = 1\) and given \(X = 0\) in the eligible population.
When there is confounding but no selection bias, we can use our study sample to estimate the distributions of \(C\) in the exposed and the unexposed in the eligible population but not the marginal distribution of \(C\)
If \(S\) is independent of \(C\), then the distribution of \(C\) in our study sample is a random sample from the distribution of \(C\) in the eligible population. In a cohort study where selection depends on exposure \(X\) and \(C\) is a confounder, there will almost always be an open path from \(C\) to \(S\) in a causal DAG representing the study. In Figure 17.1, we have the open path \(C \rightarrow X \rightarrow S\) even if we remove the path \(C \rightarrow S\) that causes selection bias.
If \(S\) is independent of \(C\) given \(X\), then the distribution of \(C\) given \(X = x\) in the study sample is a random sample from the distribution of \(C\) in the eligible subpopulation with \(X = x\). In a cohort study where selection depends on \(X\) and there is selection bias through \(C\), then there will almost always be an open path from \(C\) to \(S\) even when we condition on \(X\). In Figure 17.1, we have the open path \(C \rightarrow S\).
When our study sample is a random sample from the eligible population, we can use our study sample to estimate the distribution of \(C\) or the conditional distribution of \(C\) given \(X\) in the eligible population. This is rarely the case. In a cohort study where selection is determined by \(X\), we can get the marginal distribution of \(C\) when there is no association between \(C\) and \(S\) and we can get the conditional distribution of \(C\) given \(X\) when there is no association between \(C\) and \(S\) given \(X\).
When there is confounding by \(C\), the marginal distribution of \(C\) differs systematically between the study sample and the eligible population because of an open path from \(C\) to \(S\) through \(X\). When there is no selection bias, \(C\) and \(S\) are d-separated by conditioning on \(X\), we can use the study sample to estimate the conditional distribution of \(C\) given \(X\) in the eligible population. You can see this by removing the path \(C \rightarrow S\) from the DAG in Figure 17.1.
When there is selection bias by \(C\), both the marginal distribution of \(C\) and the conditional distribution of \(C\) given \(X\) differs systematically between the study sample and the eligible population because there is open path from \(C\) to \(S\) that is not closed by conditioning on \(X\).
For the risk difference, calculating standardized risks and then taking the difference is the same as taking the same weighted average of the stratum-specific risk differences. The standardized risk difference \(\RR_\std\) equals \[
\sum_c p_{1c} \Prstd(C = c) - \sum_c p_{0c} \Prstd(C = c) \\
= \sum_c (p_{1c} - p_{0c}) \Prstd(C = c).
\] The standardized risk difference using the entire population is called the average treatment effect (ATE). This can be estimated using data from a cohort study if there is no confounding or selection bias by \(C\). The average treatment effect among the treated (ATET) is the standardized risk difference using the distribution of \(C\) in the exposed or treated population, and the average treatment effect among controls (ATEC) is the standardized risk difference using the distribution of \(C\) unexposed or control population. These can be estimated when there is no selection bias through \(C\). For measures other than the risk difference, we can talk about the marginal treatment effect, the treatment effect among the treated, or the treatment effect among controls.
17.2.4 Confidence limits
When the standard distribution of \(C\) is fixed and the stratum-specific risks are estimated independently (i.e., the estimated risks are independent), the variance of a standardized risk can be estimated using Equation 1.12: \[
\hat{\Var}\bigl(\hat{\Prstd}(D = 1 \given{} X = x, S = 1)\bigr)
= \sum_c \hat{\Var}(\hat{p}_{xc}) \Prstd(C = c)^2
\] The variance of a standardized measure of association can then be obtained using the delta method from Section 3.4.1. For the risk difference, no transformation is needed. For the risk ratio, we use a log transformation. For the odds ratio, we use a logit transformation. For the cumulative hazard ratio, we use a complementary log-log transformation.
When the estimated risks in different strata of \(C\) are not independent (e.g., they are estimated using \(C\) as a predictor in a regression model), then we must account for the covariances of the estimated risks in different strata. When the distribution of \(C\) is estimated (e.g., we are using the distribution of \(C\) in the study sample), then we must account for the uncertainty in the distribution of \(C\). Bootstrapping can account for all of these sources of variation.
17.3 Simpson’s paradox standardized
The DAG in Figure 15.6 shows the causal structure underlying the example given by Simpson (1951) that is reproduced in Table 15.1. They show that conditioning on biological sex removes all confounding and selection bias, so the conditional odds ratio is a better estimate of the effect of treatment than the crude odds ratio. The example is constructed so that the conditional odds ratio is exactly the same for males and females, but this is too much to hope for in reality. Standardization gives us a less fragile point of view.
17.3.1 Crude risks and measures of association
In this example, the crude risk of death under treatment is \[
\Pr(D = 1 \given{} X = 1, S = 1)
= \frac{20}{20 + 20}
= 0.5
\] and the crude risk of death under control is \[
\Pr(D = 1 \given{} X = 0, S = 1)
= \frac{6}{6 + 6}
= 0.5.
\] The corresponding crude measures of association are \[
\RD_\crude = 0
\] and \[
\RR_\crude = \OR_\crude = \CHR_\crude = 1.
\] Thus, all crude measures of association show no apparent effect of treatment on the risk of death.
Because there is confounding by biological sex, the crude risks are not unbiased estimates the causal risks that would occur if we intervened to make the entire eligible population treated or untreated. The sex distribution differs between the treated and control groups, and sex is a predictor of mortality in the example. There are \(5 + 8 = 13\) treated males and \(15 + 12 = 27\) treated females, so \[
\Pr(\text{male} \given{} X = 1, S = 1)
= \frac{13}{13 + 27}
= 0.325.
\] There are \(3 + 4 = 7\) untreated males and \(3 + 2 = 5\) untreated females, so \[
\Pr(\text{male} \given{} X = 0, S = 1)
= \frac{7}{7 + 5}
\approx 0.583.
\] The crude risks do not have a causal interpretation in terms of a hypothetical experiment, and the crude measures of association do not represent marginal causal effects.
# Crude measures of association in Simpson's paradox (JRSSB, 1951)# data framesimpson <-data.frame(male =rep(c(0, 1), each =4),treated =rep(c(0, 1, 0, 1), each =2),dead =rep(c(0, 1), times =4),count =c(2, 3, 12, 15, 4, 3, 8, 5))# function to calculate riskrisk <-function(rows) {# rows is a vector of TRUE/FALSE that selects rows count <- simpson$count[rows] dead <- simpson$dead[rows]sum(count * dead) /sum(count)}# odds and cumulative hazardodds <-function(p) p / (1- p)chaz <-function(p) -log(1- p)# crude risks and measures of associationp1 <-risk(simpson$treated ==1)p0 <-risk(simpson$treated ==0)RD <- p1 - p0RR <- p1 / p0OR <-odds(p1) /odds(p0)CHR <-chaz(p1) /chaz(p0)
17.3.2 Conditional risks and measures of association
According to the DAG in Figure 15.6, conditioning on biological sex removes all confounding and selection bias. Among females, the risk of death in the treated is \[
\Pr(D = 1 \given{} \text{female}, X = 1, S = 1)
= \frac{15}{15 + 12}
\approx 0.56
\] and the risk of death in the untreated is \[
\Pr(D = 1 \given{} \text{female}, X = 0, S = 1)
= \frac{3}{3 + 2}
= 0.6.
\] Assuming the DAG in Figure 15.6 is correct, these can be interpreted as conditional causal risks given female sex. The causal risk of death under treatment is less than the causal risk of death under no treatment, suggesting that treatment reduces mortality in females. Given female sex, the conditional risk difference is \[
\RD_\text{female}
= \frac{15}{27} - \frac{3}{5}
\approx -0.044,
\] the conditional risk ratio is \[
\RR_\text{female}
= \frac{15 / 27}{3 / 5}
\approx 0.926,
\] the conditional odds ratio is \[
\OR_\text{female}
= \frac{\odds(15 / 27)}{\odds(3 / 5)}
\approx 0.833,
\] and the conditional cumulative hazard ratio is \[
\CHR_\text{female}
= \frac{-\ln(1 - 15 / 27)}{-\ln(1 - 3 / 5)}
\approx 0.885.
\] The risk difference is below zero and the ratio measures are all below one. Because they are based on conditional causal risks, these estimate the conditional causal effect of treatment given female sex.
Among males, the risk of death in the treated is \[
\Pr(D = 1 \given{} \text{male}, X = 1, S = 1)
= \frac{5}{5 + 8}
\approx 0.385
\] and the risk of death among among the untreated is \[
\Pr(D = 1 \given{} \text{male}, X = 0, S = 1)
= \frac{3}{3 + 4}
\approx 0.429.
\] Assuming the DAG in Figure 15.6 is correct, these can be interpreted as conditional causal risks given male sex. As in females, the causal risk of death under treatment is less than the causal risk of death under no treatment, suggesting that treatment reduces mortality among males. Given male sex, the conditional risk difference is \[
\RD_\text{male}
= \frac{5}{13} - \frac{3}{7}
\approx -0.044,
\] the conditional risk ratio is \[
\RR_\text{male}
= \frac{5 / 13}{3 / 7}
\approx 0.897,
\] the conditional odds ratio is \[
\OR_\text{male}
= \frac{\odds(5 / 13)}{\odds(3 / 7)}
\approx 0.833,
\] and the conditional cumulative hazard ratio is \[
\CHR_\text{male}
= \frac{-\ln(1 - 5 / 13)}{-\ln(1 - 3 / 7)}
\approx 0.868.
\] Because they are based on conditional causal risks, these estimate the conditional causal effect of treatment given male sex. These are similar to the causal effect estimates for females, but only the odds ratios are identical (both equal to \(5 / 6\)). There is effect measure modification on all other scales.
# Conditional measures of association in Simpson's paradox (JRSSB, 1951)# data framesimpson <-data.frame(male =rep(c(0, 1), each =4),treated =rep(c(0, 1, 0, 1), each =2),dead =rep(c(0, 1), times =4),count =c(2, 3, 12, 15, 4, 3, 8, 5))# function to calculate riskrisk <-function(rows) {# rows is a vector of TRUE/FALSE that selects rows count <- simpson$count[rows] dead <- simpson$dead[rows]sum(count * dead) /sum(count)}# odds and cumulative hazardodds <-function(p) p / (1- p)chaz <-function(p) -log(1- p)# conditional risks and measures of association among femalesp1f <-risk(with(simpson, treated ==1& male ==0))p0f <-risk(with(simpson, treated ==0& male ==0))RDf <- p1f - p0fRRf <- p1f / p0fORf <-odds(p1f) /odds(p0f)CHRf <-chaz(p1f) /chaz(p0f)# conditional risks and measures of association among femalesp1m <-risk(with(simpson, treated ==1& male ==1))p0m <-risk(with(simpson, treated ==0& male ==1))RDm <- p1m - p0mRRm <- p1m / p0mORm <-odds(p1m) /odds(p0m)CHRm <-chaz(p1m) /chaz(p0m)
17.3.3 Standardized risks and measures of association
Assuming the DAG in Figure 15.6 is correct, we can calculate marginal causal risks by standardizing to the same distribution of biological sex under treatment and no treatment. In a population that is half female and half male, the causal risk of death under treatment is \[
\begin{aligned}
&\Prstd(D = 1 \given{} X = 1, S = 1) \\
&\qquad = \frac{1}{2} \Pr(D = 1 \given{} \text{female}, X = 1, S = 1)
+ \frac{1}{2} \Pr(D = 1 \given{} \text{male}, X = 1, S = 1) \\
&\qquad \approx 0.470
\end{aligned}
\] and the causal risk of death under no treatment is \[
\begin{aligned}
&\Prstd(D = 1 \given{} X = 1, S = 1) \\
&\qquad = \frac{1}{2} \Pr(D = 1 \given{} \text{female}, X = 0, S = 1)
+ \frac{1}{2} \Pr(D = 1 \given{} \text{male}, X = 0, S = 1) \\
&\qquad \approx 0.514.
\end{aligned}
\] The causal risk of death under treatment is lower, suggesting that treatment would reduce mortality in this population. These estimated causal risks can be used to calculate standardized measures of association. From Equation 17.10, the standardized risk difference is \[
\RD_\std
\approx -0.044.
\] From Equation 17.11, the standardized risk ratio is \[
\RR_\std
\approx 0.914.
\] From Equation 17.12, the standardized odds ratio is \[
\OR_\std
\approx 0.873.
\] From Equation 17.13, the standardized cumulative hazard ratio is \[
\CHR_\std
\approx 0.879.
\] As with crude and conditional measures, the standardized cumulative hazard ratio is between the standardized risk ratio and odds ratio.
# Standardized measures of association in Simpson's paradox (JRSSB, 1951)# data framesimpson <-data.frame(male =rep(c(0, 1), each =4),treated =rep(c(0, 1, 0, 1), each =2),dead =rep(c(0, 1), times =4),count =c(2, 3, 12, 15, 4, 3, 8, 5))# function to calculate riskrisk <-function(rows) {# rows is a vector of TRUE/FALSE that selects rows count <- simpson$count[rows] dead <- simpson$dead[rows]sum(count * dead) /sum(count)}# odds and cumulative hazardodds <-function(p) p / (1- p)chaz <-function(p) -log(1- p)# conditional risks among femalesp1f <-risk(with(simpson, treated ==1& male ==0))p0f <-risk(with(simpson, treated ==0& male ==0))# conditional risks among malesp1m <-risk(with(simpson, treated ==1& male ==1))p0m <-risk(with(simpson, treated ==0& male ==1))# standardized risks (standard population half female and half male)propf <-0.5propm <-1- pfp1std <- propf * p1f + propm * p1mp0std <- propf * p0f + propm * p0m# standardized measures of associationRDstd <- p1std - p0stdRRstd <- p1std / p0stdORstd <-odds(p1std) /odds(p0std)CHRstd <-chaz(p1std) /chaz(p0std)
If there is no effect measure modification on a scale that is collapsible, the standardized measure will equal the conditional measures of association in all standard populations. If there is effect measure modification or noncollapsibility, the standardized measure will depend on the standard population used. In this example, there is effect measure modification on the risk difference and risk ratio scales. There is no effect measure modification on the odds ratio scale, but the odds ratio is noncollapsible. There is both effect measure modification and noncollapsibility on the cumulative hazard ratio scale. Therefore, all four standardized measures of association depend on the standard population used. Figure 17.3 shows this for the risk ratio, odds ratio, and cumulative hazard ratio.
Code
simpson-std-plot.R
# Standardized measures of association in Simpson's paradox (JRSSB, 1951)# data framesimpson <-data.frame(male =rep(c(0, 1), each =4),treated =rep(c(0, 1, 0, 1), each =2),dead =rep(c(0, 1), times =4),count =c(2, 3, 12, 15, 4, 3, 8, 5))# function to calculate riskrisk <-function(rows) {# rows is a vector of TRUE/FALSE that selects rows count <- simpson$count[rows] dead <- simpson$dead[rows]sum(count * dead) /sum(count)}# odds and cumulative hazardodds <-function(p) p / (1- p)chaz <-function(p) -log(1- p)# conditional risks among femalesp1f <-risk(with(simpson, treated ==1& male ==0))p0f <-risk(with(simpson, treated ==0& male ==0))# conditional risks among malesp1m <-risk(with(simpson, treated ==1& male ==1))p0m <-risk(with(simpson, treated ==0& male ==1))# standardized risks as a function of proportion female# Both functions are designed to work if propf is a vector.p1std <-function(propf) { propm <-1- propf propf * p1f + propm * p1m}p0std <-function(propf) { propm <-1- propf propf * p0f + propm * p0m}# plot of standardized risk ratio, odds ratio, and cumulative hazard ratiopropf <-seq(0, 1, by =0.01)plot(propf, p1std(propf) /p0std(propf), type ="l", ylim =c(0.8, 1),xlab ="Proportion female in the standard population",ylab ="Standardized measure of association")lines(propf, odds(p1std(propf)) /odds(p0std(propf)), lty ="dashed")lines(propf, chaz(p1std(propf)) /chaz(p0std(propf)), lty ="dotted")grid()legend("topleft", bg ="white", lty =c("solid", "dotted", "dashed"),legend =c("Risk ratio", "Cumulative hazard ratio", "Odds ratio"))
Figure 17.3: The standardized risk ratio, odds ratio, and cumulative hazard ratio comparing the standard population under treatment to itself under no treatment as a function of the proportion female. The odds ratio is nearly constant, with just a slight bend due to noncollapsibility.
Simpson, Edward H. 1951. “The Interpretation of Interaction in Contingency Tables.”Journal of the Royal Statistical Society: Series B (Methodological) 13 (2): 238–41.
Star Wars is a space opera film written and directed by George Lucas, produced by Gary Kurtz, and distributed by 20th Century Fox. It was released on May 25, 1977. Obi-Wan Kenobi was played by Alec Guinness. The events depicted took place a long time ago in a galaxy far, far away …↩︎