ovb_extreme_plot | R Documentation |
Extreme scenario 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 shows the partial R2 of the unobserved confounder(s) with the treatment. The vertical axis shows the adjusted treatment effect estimate.
The partial R2 of the confounder with the outcome is represented by different curves for each scenario, as given by the parameter r2yz.dx
.
The red marks on horizontal axis are bounds on the partial R2 of the unobserved confounder kd
times as strong as the covariates used for benchmarking.
The dotted red line represent the threshold for the effect estimate deemed to be problematic (for instance, zero).
See Cinelli and Hazlett (2020) for details.
ovb_extreme_plot(...)
## S3 method for class 'lm'
ovb_extreme_plot(
model,
treatment,
benchmark_covariates = NULL,
kd = 1,
r2yz.dx = c(1, 0.75, 0.5),
r2dz.x = NULL,
reduce = TRUE,
threshold = 0,
lim = min(c(r2dz.x + 0.1, 0.5)),
legend = TRUE,
cex.legend = 0.65,
legend.bty = "n",
...
)
## S3 method for class 'fixest'
ovb_extreme_plot(
model,
treatment,
benchmark_covariates = NULL,
kd = 1,
r2yz.dx = c(1, 0.75, 0.5),
r2dz.x = NULL,
reduce = TRUE,
threshold = 0,
lim = min(c(r2dz.x + 0.1, 0.5)),
legend = TRUE,
cex.legend = 0.65,
legend.bty = "n",
...
)
## S3 method for class 'formula'
ovb_extreme_plot(
formula,
method = c("lm", "feols"),
vcov = "iid",
data,
treatment,
benchmark_covariates = NULL,
kd = 1,
r2yz.dx = c(1, 0.75, 0.5),
r2dz.x = NULL,
reduce = TRUE,
threshold = 0,
lim = min(c(r2dz.x + 0.1, 0.5)),
legend = TRUE,
cex.legend = 0.65,
legend.bty = "n",
...
)
## S3 method for class 'numeric'
ovb_extreme_plot(
estimate,
se,
dof,
r2dz.x = NULL,
r2yz.dx = c(1, 0.75, 0.5),
reduce = TRUE,
threshold = 0,
lim = min(c(r2dz.x + 0.1, 0.5)),
legend = TRUE,
legend.title = NULL,
cex.legend = 0.65,
legend.bty = "n",
xlab = NULL,
ylab = NULL,
cex.lab = 0.7,
cex.axis = 0.7,
list.par = list(oma = c(1, 1, 1, 1)),
...
)
... |
arguments passed to other methods. First argument should either be an |
model |
An |
treatment |
A character vector with the name of the treatment variable of the model. |
benchmark_covariates |
The user has two options: (i) character vector of the names of covariates that will be used to bound the plausible strength of the unobserved confounders. Each variable will be considered separately; (ii) a named list with character vector names of covariates that will be used, as a group, to bound the plausible strength of the unobserved confounders. The names of the list will be used for the benchmark labels. Note: for factor variables with more than two levels, you need to provide the name of each level as encoded in the |
kd |
numeric vector. Parameterizes how many times stronger the confounder is related to the treatment in comparison to the observed benchmark covariate.
Default value is |
r2yz.dx |
hypothetical partial R2 of unobserved confounder Z with outcome Y, given covariates X and treatment D. |
r2dz.x |
hypothetical partial R2 of unobserved confounder Z with treatment D, given covariates X. |
reduce |
should the bias adjustment reduce or increase the
absolute value of the estimated coefficient? Default is |
threshold |
estimate threshold. |
lim |
sets limit for both axis. If 'NULL', limits are computed automatically. |
legend |
should legend be plotted? Default is |
cex.legend |
size of the text for the legend. |
legend.bty |
legend box. See |
formula |
an object of the class |
method |
the default is |
vcov |
the variance/covariance used in the estimation when using |
data |
data needed only when you pass a formula as first parameter. An object of the class |
estimate |
Coefficient estimate. |
se |
standard error of the coefficient estimate. |
dof |
residual degrees of freedom of the regression. |
legend.title |
the legend title. If |
xlab |
label of x axis. If 'NULL', default label is used. |
ylab |
label of y axis. If 'NULL', default label is used. |
cex.lab |
The magnification to be used for x and y labels relative to the current setting of cex. |
cex.axis |
The magnification to be used for axis annotation relative to the current setting of cex. |
list.par |
arguments to be passed to |
The function returns invisibly the data used for the extreme plot.
Cinelli, C. and Hazlett, C. (2020), "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).
# runs regression model
model <- lm(peacefactor ~ directlyharmed + age + farmer_dar + herder_dar +
pastvoted + hhsize_darfur + female + village,
data = darfur)
# extreme scenarios plot
ovb_extreme_plot(model, treatment = "directlyharmed",
benchmark_covariates = "female",
kd = 1:2,
lim = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.