Skip to content

rswp

Rosenbaum sensitivity bounds for matched pairs

rswp(d, gam = 1, alpha = 0.05)
rshl(d, gam = 1)

How strong would hidden bias have to be to explain away a matched-pairs result? gam is Gamma, the most the odds of treatment can differ within a pair because of an unobserved covariate (1: no hidden bias). rswp() gives the bounds on the one-sided p-value of Wilcoxon’s signed-rank test at each Gamma (Rosenbaum 1987), from the normal approximation, and the Gamma at which the upper bound reaches alpha. rshl() gives the bounds on the Hodges-Lehmann estimate of the effect (Rosenbaum 1993), computed exactly from the Walsh averages, with no grid.

d

The treated-minus-control differences: finite numbers, one per pair.

gam

Values of Gamma: numbers from 1.

alpha

The level for the critical Gamma, strictly between 0 and 0.5.

rswp(): a list of p (a data frame of gam, plo, pup), gcrit (the critical Gamma, below 1 when the test is not significant without bias) and t (the signed-rank statistic). rshl(): a data frame of gam, lo, hi. NaN when every difference is 0.

Rosenbaum, P. R. (1987). Sensitivity analysis for certain permutation inferences in matched observational studies. Biometrika, 74(1), 13-26. doi:10.1093/biomet/74.1.13

Rosenbaum, P. R. (1993). Hodges-Lehmann point estimates of treatment effect in observational studies. Journal of the American Statistical Association, 88(424), 1250-1253. doi:10.1080/01621459.1993.10476405

set.seed(1)
d <- rnorm(50, 0.5)
rswp(d, gam = c(1, 1.5, 2))
rshl(d, gam = c(1, 1.5, 2))

Generated from the R help page: rswp in the R reference.