Skip to contents

Thin wrapper over rbounds::psens() when rbounds is installed (rank-matched-pair signed-rank bounds across a Gamma grid). Without rbounds, falls back to a base R normal- approximation Wilcoxon signed-rank computation.

Usage

sensitivity_rosenbaum(
  data,
  treatment,
  outcome,
  covariates,
  gamma_range = c(1, 3),
  n_gamma = 20L
)

Arguments

data

Data frame with treatment + outcome columns.

treatment

Binary treatment column (0/1).

outcome

Outcome column.

covariates

Covariates (used only for matching approximation, here a simple rank-match).

gamma_range

c(min, max) of Gamma. Default c(1, 3).

n_gamma

Number of Gamma values. Default 20.

Value

Data frame with Gamma, p_lower, p_upper.

Examples

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