Learn R Programming

sensemakr (version 0.1.2)

ovb_extreme_plot: Extreme scenarios plots of omitted variable bias

Description

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 (2018) for details.

Usage

ovb_extreme_plot(...)

# S3 method for 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.5, legend.bty = "o", ...)

# S3 method for formula ovb_extreme_plot(formula, 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.5, legend.bty = "o", ...)

# S3 method for 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, cex.legend = 0.5, legend.bty = "o", ...)

Arguments

...

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.

model

An lm object with the outcome regression.

treatment

A character vector with the name of the treatment variable of the model.

benchmark_covariates

a character vector of the names of covariates that will be used to bound the plausible strength of the unobserved confounders.

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 1 (confounder is as strong as benchmark covariate).

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 TRUE.

threshold

estimate threshold.

lim

sets limit of the plot.

legend

should legend be plotted? Default is TRUE.

cex.legend

size of the text for the legend.

legend.bty

legend box. See bty argument of par.

formula

an object of the class formula: a symbolic description of the model to be fitted.

data

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.

estimate

Coefficient estimate.

se

Standard error of the coefficient estimate.

dof

Residual degrees of freedom of the regression.

Value

The function returns invisibly the data used for the extreme plot.

References

Cinelli, C. and Hazlett, C. "Making Sense of Sensitivity: Extending Omitted Variable Bias." (2018).

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab