Skip to content

Commit

Permalink
add sensitivity analysis section
Browse files Browse the repository at this point in the history
  • Loading branch information
LucyMcGowan committed Sep 19, 2024
1 parent b0a31c4 commit 2b06c4f
Showing 1 changed file with 108 additions and 1 deletion.
109 changes: 108 additions & 1 deletion chapters/21-sensitivity.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,113 @@ For instance, you may feel like these two DAGs are equally plausible or want to
Thus far, we've probed some of the assumptions we've made about the causal structure of the question.
We can take this further using quantitative bias analysis, which uses mathematical assumptions to see how results would change under different conditions.

### Tipping point analyses
### Sensitivity analyses for unmeasured confounders

Sensitivity analyses for unmeasured confounding are important tools in observational studies to assess how robust findings are to potential unmeasured factors.[@d2022sensitivity] These analyses rely on three key components:

1) the observed exposure-outcome effect after adjusting for measured confounders, 2) the estimated relationship between a hypothetical unmeasured confounder and the exposure, and
3) the estimated relationship between that unmeasured confounder and the outcome.

By specifying plausible values for these relationships, researchers can quantify how much the observed effect might change if such an unmeasured confounder existed. Various methods are available depending on the type of outcome (e.g. continuous, binary, time-to-event) and how much is known about potential unmeasured confounders. While these analyses cannot prove the absence of unmeasured confounding, they provide valuable insight into how sensitive results are to violations of the "no unmeasured confounders" assumption that is crucial for causal inference in observational studies.

#### Observed exposure-outcome effect

The first componenet, the observed exposure-outcome effect, is the proposed causal effect of interest, i.e. the effect you would like to perform a sensitivity analysis on. The effect itself will depend on the choice of outcome model, which in turn often depends on the distribution of the outcome and the desired effect measure:

1. For continuous outcomes: Linear models or generalized linear models (GLMs) with Gaussian distribution and identity link are used, typically estimating a coefficient.

2. For binary outcomes, we have a few choices:

* GLMs with binomial distribution and log link
* GLMs with Poisson distribution and log link
* GLMs with binomial distribution and logit link
These estimate coefficients, which can be exponentiated to obtain risk ratios (log link models) or odds ratios (logit link models).


3. For time-to-event outcomes: Cox proportional hazards models are used, with the hazard ratio obtained by exponentiating the coefficient.

#### Unmeasured confounder-exposure effect

The relationship between an unmeasured confounder and the exposure can be characterized in three ways:

1. For a binary unmeasured confounder:

* Prevalence of the unmeasured confounder in the exposed group
* Prevalence of the unmeasured confounder in the unexposed group

2. For a continuous unmeasured confounder (assuming Gaussian distribution and unit variance):

* Difference in means of the unmeasured confounder between exposed and unexposed groups

3. Distribution-agnostic approach:

* Partial $R^2$, representing the proportion of variation in the exposure explained by the unmeasured confounder after accounting for measured confounders

These characterizations allow researchers to specify the unmeasured confounder-exposure relationship in sensitivity analyses, accommodating different types of confounders and levels of knowledge about their distribution.

#### Unmeasured confounder-outcome effect

The relationship between an unmeasured confounder and the outcome can be quantified in two main ways:

1. Coefficient-based approach: Estimate the coefficient for an unmeasured confounder in a fully adjusted outcome model. You can also estimate the exponentiated coefficient (risk ratio, odds ratio, or hazard ratio)

2. Distribution-agnostic approach (for continuous outcomes): Use partial $R^2$, representing the proportion of variation in the outcome explained by the unmeasured confounder after accounting for the exposure and measured confounders

Below is a table, reproduced from @d2022sensitivity, that maps these quantities to mathematical symbols.

| Notation | Meaning |
|----------|---------|
| $X$ | exposure |
| $Y$ | outcome |
| $\mathbf{Z}$ | all measured confounders |
| $U$ | the unmeasured confounder |
| **Observed exposure - outcome relationship** | |
| $\beta_{Y\sim X | \mathbf{Z}}$| The coefficient for the exposure, $X$, from a model with the outcome Y adjusted for any measured confounders $\mathbf{Z}$ |
| $RR_{Y\sim X |\mathbf{Z}}$ | The risk ratio for the exposure, $X$, from a model with the outcome, $Y$, adjusted for any measured confounders $\mathbf{Z}$|
| **Updated exposure - outcome relationship after adjusting for the unmeasured confounder** | |
| $\beta_{Y\sim X |U+\mathbf{Z}}$ | The updated coefficient for the exposure, $X$, from a model with the outcome $Y$ adjusted for the unmeasured confounder, $U$, and any measured confounders $\mathbf{Z}$ |
| $RR_{Y\sim X |U+\mathbf{Z}}$ | The updated risk ratio for the exposure, $X$, from a model with the outcome, $Y$, adjusted for the unmeasured confounder, $U$, and any measured confounders $\mathbf{Z}$ |
| **Unmeasured confounder - exposure relationship** | |
| $p_0$ | the prevalence of a binary unmeasured confounder in the unexposed group |
| $p_1$ | the prevalence of a binary unmeasured confounder in the exposed group |
| $m_0$ | the mean of a normally distributed unmeasured confounder with unit variance in the unexposed group |
| $m_1$ | the mean of a normally distributed unmeasured confounder with unit variance in the exposed group |
| $d$ | $m_1$ - $m_0$ the difference in the normally distributed unmeasured confounder's means between exposure groups |
| $R^2_{X\sim U |\mathbf{Z}}$ | The proportion of variation in the exposure explained by the unmeasured confounder after the measured covariates are removed (partial $R^2$) |
| **Unmeasured confounder - outcome relationship** | |
| $\beta_{Y\sim U |X+\mathbf{Z}}$ | The coefficient for the unmeasured confounder, $U$, from a model with the outcome $Y$ adjusted for the exposure, $X$, and any measured confounders $\mathbf{Z}$ |
| $RR_{Y\sim U|X+\mathbf{Z}}$ | The risk ratio for the unmeasured confounder, $U$, from a model with the outcome, $Y$, adjusted for the exposure, $X$, and any measured confounders $\mathbf{Z}$ |
| $R^2_{Y\sim U |X+\mathbf{Z}}$| The proportion of variation in the outcome explained by the unmeasured confounder after the exposure and measured covariates are removed (partial $R^2$) |
: Mathematical Notation, reproduced from @d2022sensitivity

#### Putting the components together

Once you have estimated the above three quantities, we can calculate a updated effect estimate between the exposure and outcome that takes into account an unmeasured factor like the one specified. We can use the {tipr} R package to perform these analyses. Examine @tbl-sens to see how the factors described above can be used to perform a sensitivity analysis as well as how these map to the R functions in {tipr}.

| Outcome | Effect of Interest | Sensitivity analysis equation | R function from the `tipr` package |
|---------|--------------------|-----------------------------|-------------------------------------|
| **Unmeasured confounder, $U$, is Normally distributed with a difference in means between exposure groups of $d$, unit variance, and association with $Y$ of $\beta_{Y \sim U \| X + \mathbf{Z}}$** |
| Continuous | Coefficient | $\beta_{Y\sim X \| U + \mathbf{Z}} = \beta_{Y\sim X \| \mathbf{Z}} - \beta_{Y \sim U \| X + \mathbf{Z}}\times d$ | `adjust_coef()` |
| Binary[^1] | Coefficient | $\beta_{Y\sim X \| U + \mathbf{Z}} = \beta_{Y\sim X \| \mathbf{Z}} - \beta_{Y \sim U \| X + \mathbf{Z}}\times d$ | `adjust_coef()` |
| Time to event | Coefficient | $\beta_{Y\sim X \| U + \mathbf{Z}} \approx \beta_{Y\sim X \| \mathbf{Z}} - \beta_{Y \sim U \| X + \mathbf{Z}}\times d$ | `adjust_coef()` |
| Binary | Risk ratio | $\textrm{RR}_{Y \sim X \| U + \mathbf{Z}} = \frac{\textrm{RR}_{Y \sim X \|\mathbf{Z}}}{\textrm{RR}_{Y \sim U \| X + \mathbf{Z}}^{d}}$ | `adjust_rr()` |
| Binary | Odds ratio | $\textrm{OR}_{Y \sim X \| U + \mathbf{Z}} \approx \frac{\textrm{OR}_{Y \sim X \|\mathbf{Z}}}{\textrm{OR}_{Y \sim U \| X + \mathbf{Z}}^{d}}$ | `adjust_or()` |
| Time to event | Hazard ratio | $\textrm{HR}_{Y \sim X \| U + \mathbf{Z}} \approx \frac{\textrm{HR}_{Y \sim X \|\mathbf{Z}}}{\textrm{HR}_{Y \sim U \| X + \mathbf{Z}}^{d}}$ | `adjust_hr()` |
| **Unmeasured confounder, $U$, is binary with prevalence in the unexposed group of $p_0$ in the exposed group of $p_1$, and association with $Y$ of $\beta_{Y \sim U \| X + \mathbf{Z}}$** |
| Binary[^1] | Coefficient | $\beta_{Y\sim X \| U + \mathbf{Z}} = \beta_{Y\sim X \| \mathbf{Z}} - \textrm{log}\frac{e^{\beta_{Y \sim U \| X + \mathbf{Z}}}p_1 + (1-p_1)}{e^{\beta_{Y \sim U\|X +\mathbf{Z}}}p_0 + (1 - p_0)}$ | `adjust_coef_with_binary()` |
| Time to event | Coefficient | $\beta_{Y\sim X \| U + \mathbf{Z}} \approx \beta_{Y\sim X \| \mathbf{Z}} - \textrm{log}\frac{e^{\beta_{Y \sim U \| X + \mathbf{Z}}}p_1 + (1-p_1)}{e^{\beta_{Y \sim U\|X +\mathbf{Z}}}p_0 + (1 - p_0)}$ | `adjust_coef_with_binary()` |
| Binary | Risk ratio | $\textrm{RR}_{Y \sim X \| U + \mathbf{Z}} = \textrm{RR}_{Y \sim X \|\mathbf{Z}}\frac{\textrm{RR}_{Y \sim U \| X + \mathbf{Z}} p_0+(1-p_0)}{\textrm{RR}_{Y \sim U \| X + \mathbf{Z}} p_1+(1-p_1)}$ | `adjust_rr_with_binary()` |
| Binary | Odds ratio | $\textrm{OR}_{Y \sim X \| U + \mathbf{Z}} \approx \textrm{OR}_{Y \sim X \|\mathbf{Z}}\frac{\textrm{OR}_{Y \sim U \| X + \mathbf{Z}} p_0+(1-p_0)}{\textrm{OR}_{Y \sim U \| X + \mathbf{Z}} p_1+(1-p_1)}$ | `adjust_or_with_binary()` |
| Time to event | Hazard ratio | $\textrm{HR}_{Y \sim X \| U + \mathbf{Z}} \approx \textrm{HR}_{Y \sim X \|\mathbf{Z}}\frac{\textrm{HR}_{Y \sim U \| X + \mathbf{Z}} p_0+(1-p_0)}{\textrm{HR}_{Y \sim U \| X + \mathbf{Z}} p_1+(1-p_1)}$ | `adjust_hr_with_binary()` |
| **Unmeasured confounder, $U$, has relationships with $X$ and $Y$ characterized by partial $R^2$ as $R^2_{X\sim U\|\mathbf{Z}}$ and $R^2_{Y\sim U\|X +\mathbf{Z}}$** |
| Continuous | Coefficient | $\beta_{Y\sim X \|U + \mathbf{Z}} = \beta_{Y\sim X \| \mathbf{Z}} - \textrm{se}(\beta_{Y\sim X \| \mathbf{Z}})\sqrt{\frac{R^2_{Y\sim U \|X+\mathbf{Z}}\times R^2_{X\sim U\|\mathbf{Z}}}{(1 - R^2_{X\sim U\|\mathbf{Z}})}\textrm{df}}$ | `adjust_coef_with_r2()` |
: Sensitivity analysis equations and R code from @d2022sensitivity {#tbl-sens}

[^1]: The equality will hold for binary outcomes fit via a loglinear model. Otherwise, this is an approximation.


#### Tipping point analyses



### Other types of QBA

0 comments on commit 2b06c4f

Please sign in to comment.