
Rosenbaum bounds sensitivity analysis (data-frame interface)
Source:R/effects.R
sensitivity_rosenbaum.RdNative base R rank-matched-pair signed-rank bounds across a Gamma grid, via the normal approximation to the Wilcoxon signed-rank statistic.
Usage
sensitivity_rosenbaum(
data,
treatment,
outcome,
covariates,
gamma_range = c(1, 3),
n_gamma = 20L
)Examples
if (requireNamespace("EValue", quietly = TRUE) && requireNamespace("rbounds", quietly = TRUE)) {
set.seed(1)
df <- data.frame(d = rbinom(60, 1, 0.5), x1 = rnorm(60))
df$y <- df$d * 0.5 + df$x1 + rnorm(60)
res <- try(sensitivity_rosenbaum(df, "d", "y", "x1"))
if (!inherits(res, "try-error")) str(res, max.level = 1)
}
#> 'data.frame': 20 obs. of 3 variables:
#> $ Gamma : num 1 1.11 1.21 1.32 1.42 ...
#> $ p_lower: num 9.60e-07 2.77e-07 7.99e-08 2.32e-08 6.74e-09 ...
#> $ p_upper: num 9.60e-07 2.98e-06 7.60e-06 1.68e-05 3.29e-05 ...