
Omitted-variable bias on a fitted model (sensemakr extender)
Source:R/sensitivity.R
morie_sensitivity_omitted_var_bias.RdThin interface to sensemakr::sensemakr: returns the full
Cinelli-Hazlett robustness-value object including benchmark
bounds, adjusted t-statistics, and the data needed to draw
contour plots. Pairs with omitted_variable_bias,
which is the closed-form version that takes estimate +
se + degrees of freedom directly (useful when you don't
have an lm object handy).
Usage
morie_sensitivity_omitted_var_bias(
model,
treatment,
benchmark_covariates = NULL,
kd = c(1, 2, 3),
ky = NULL,
q = 1,
alpha = 0.05,
...
)Arguments
- model
A fitted regression model (
lmor compatible).- treatment
Name of the treatment variable (coefficient).
- benchmark_covariates
Optional character vector of covariate names whose strengths bound the unmeasured-confounder strength.
- kd
Multipliers on the benchmark covariate strength. Default
c(1, 2, 3).- ky
Multipliers on the benchmark covariate's outcome strength. Default equal to
kd.- q
Fraction of the estimate to be explained away. Default 1.
- alpha
Significance level. Default 0.05.
- ...
Additional arguments forwarded to
sensemakr::sensemakr.
Value
A list of class morie_sensitivity_omitted_var_bias
with the robustness values, partial R-squared of treatment,
benchmark bounds, and the full sensemakr object as raw.
References
Cinelli, C., & Hazlett, C. (2020). Making sense of sensitivity: extending omitted variable bias. Journal of the Royal Statistical Society B, 82(1), 39–67.
Examples
if (requireNamespace("sensemakr", quietly = TRUE)) {
set.seed(1)
df <- data.frame(d = rnorm(100), x1 = rnorm(100))
df$y <- 0.5 * df$d + 0.3 * df$x1 + rnorm(100)
fit <- stats::lm(y ~ d + x1, data = df)
res <- morie_sensitivity_omitted_var_bias(fit, "d",
benchmark_covariates = "x1")
class(res)
}
#> [1] "morie_sensitivity_omitted_var_bias" "list"