Contour plots of omitted variable bias for sensitivity analysis. The main inputs are an lm
model, the treatment variable
and the covariates used for benchmarking the strength of unobserved confounding.
The horizontal axis of the plot shows hypothetical values of the partial R2 of the unobserved confounder(s) with the treatment.
The vertical axis shows hypothetical values of the partial R2 of the unobserved confounder(s) with the outcome.
The contour levels represent the adjusted estimates (or t-values) of the treatment effect.
The reference points are the bounds on the partial R2 of the unobserved confounder if it were k
times ``as strong'' as the observed covariate used for benchmarking (see arguments kd
and ky
).
The dotted red line show the chosen critical threshold (for instance, zero): confounders with such strength (or stronger) are sufficient to invalidate the research conclusions.
All results are exact for single confounders and conservative for multiple/nonlinear confounders.
See Cinelli and Hazlett (2018) for details.
ovb_contour_plot(...)# S3 method for lm
ovb_contour_plot(model, treatment,
benchmark_covariates = NULL, kd = 1, ky = kd, r2dz.x = NULL,
r2yz.dx = r2dz.x, bound_label = NULL,
sensitivity.of = c("estimate", "t-value"), reduce = TRUE,
estimate.threshold = 0, t.threshold = 2, lim = max(c(0.4, r2dz.x,
r2yz.dx)), nlevels = 20, col.contour = "grey40",
col.thr.line = "red", label.text = TRUE, label.bump.x = 0.02,
label.bump.y = 0.02, ...)
# S3 method for formula
ovb_contour_plot(formula, data, treatment,
benchmark_covariates = NULL, kd = 1, ky = kd, r2dz.x = NULL,
r2yz.dx = r2dz.x, bound_label = NULL,
sensitivity.of = c("estimate", "t-value"), reduce = TRUE,
estimate.threshold = 0, t.threshold = 2, lim = max(c(0.4, r2dz.x,
r2yz.dx)), nlevels = 20, col.contour = "grey40",
col.thr.line = "red", label.text = TRUE, ...)
# S3 method for numeric
ovb_contour_plot(estimate, se, dof, r2dz.x = NULL,
r2yz.dx = r2dz.x, bound_label = "", sensitivity.of = c("estimate",
"t-value"), reduce = TRUE, estimate.threshold = 0, t.threshold = 2,
lim = max(c(0.4, r2dz.x + 0.1, r2yz.dx + 0.1)), nlevels = 20,
col.contour = "black", col.thr.line = "red", label.text = TRUE,
cex.label.text = 1, label.bump.x = 0.02, label.bump.y = 0.02, ...)
arguments passed to other methods. First argument should either be an lm
model with the
outcome regression, a formula
describing the model along
with the data.frame
containing the variables of the model,
or a numeric vector with the coefficient estimate.
An lm
object with the outcome regression.
A character vector with the name of the treatment variable of the model.
a character vector of the names of covariates that will be used to bound the plausible strength of the unobserved confounders.
numeric vector. Parameterizes how many times stronger the confounder is related to the treatment in comparison to the observed benchmark covariate.
Default value is 1
(confounder is as strong as benchmark covariate).
numeric vector. Parameterizes how many times stronger the confounder is related to the outcome in comparison to the observed benchmark covariate.
Default value is the same as kd
.
Hypothetical partial R2 of unobserved confounder Z with treatment D, given covariates X.
Hypothetical partial R2 of unobserved confounder Z with outcome Y, given covariates X and treatment D.
label to bounds provided manually in r2dz.x
and r2yz.dx
.
should the contour plot show adjusted estimates ("estimate"
)
or adjusted t-values ("t-value"
)?
Should the bias adjustment reduce or increase the
absolute value of the estimated coefficient? Default is TRUE
.
critical threshold for the point estimate.
critical threshold for the t-value.
sets limit of the plot.
number of levels for the contour plot.
color of contour lines.
color of threshold contour line.
should label texts be plotted? Default is TRUE
.
bump on the x coordinate of label text.
bump on the y coordinate of label text.
an object of the class formula
: a symbolic description of the model to be fitted.
data needed only when you pass a formula as first parameter. An object of the class data.frame
containing the variables used in the analysis.
Coefficient estimate.
Standard error of the coefficient estimate.
Residual degrees of freedom of the regression.
size of the label text.
The function returns invisibly the data used for the contour plot (contour grid and bounds).
Cinelli, C. and Hazlett, C. "Making Sense of Sensitivity: Extending Omitted Variable Bias." (2018).
# NOT RUN {
# runs regression model
model <- lm(peacefactor ~ directlyharmed + age + farmer_dar + herder_dar +
pastvoted + hhsize_darfur + female + village,
data = darfur)
# contour plot
ovb_contour_plot(model, treatment = "directlyharmed",
benchmark_covariates = "female",
kd = 1:2)
# }
Run the code above in your browser using DataLab