Skip to contents

Native sensemakr::sensemakr for a fitted linear model: robustness values, the partial R-squared of the treatment, and benchmark bounds for confounders kd / ky times as strong as each benchmark covariate (its partial R-squared with the outcome from model, with the treatment from the regression of the treatment on the other regressors). Pairs with omitted_variable_bias, the closed form from estimate, se and degrees of freedom.

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

treatment

Name of the treatment coefficient.

benchmark_covariates

Optional character vector of coefficient 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.

...

Unused.

Value

A list of class morie_sensitivity_omitted_var_bias with rv_q, rv_qa, partial_r2_treatment and benchmark_bounds (the columns of sensemakr's bounds table).

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

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",
                                          kd = 1)
res$rv_q
#> [1] 0.361986