Description Usage Arguments Details Value Author(s) References Examples
Sensitivity analysis using a d-statistic employing conditional inference to focus on those subgroups with demonstrated insensitivity to unmeasured biases.
1 |
y |
A numeric vector of treated-minus-control matched pair differences in outcomes. |
qs |
Quantiles of |y| that partly define the d-statistic. Each coordinate of qs must be a number strictly between 0 and 1; otherwise, an error will result. See Details. |
gamma |
The sensitivity parameter, a number gamma>=1. |
f |
If f is not NULL, then it must be a factor that further subdivides y beyond the subdivisions implied by qs. If f is not NULL, then the length of f must equal the length of y; otherwise, an error will result. |
fscore |
If fscore is not NULL, then fscore contains integer scores to be attached to the levels of f. If f is not NULL but fscore is NULL, then the levels of f are viewed as nominal with equal emphasis. An error will result if fscore is not NULL but: (i) the scores are not integers, (ii) f is NULL, or (iii) the number of scores does not equal the number levels of f. |
fr |
A nonnegative number. If fr=0, then the test is simply a group-rank test, using every category, without conditional inference. The recommended default of fr=1 uses a category only if the proportion of positive y's in this category is at least equal to gamma/(1+gamma), and the conditional inference corrects for selection of categories based on y. In general, a category is used if the proportion of positive y is at least fr*gamma/(1+gamma), reducing to all categories if fr=0. |
alpha |
Of limited importance, a text message interprets numerical results in terms of rejection or not of the null hypothesis of no treatment effect in a one-sided, level-alpha test in the presence of a bias in treatment assignment of at most gamma>=1. |
The method is from Rosenbaum (2019). The example reproduces aspects of this manuscript.
The default values of qs, 1/3 and 2/3, are from Brown (1981)'s test. See Markowski and Hettmansperger (1982) for discussion of other choices. See Rosenbaum (2015) for comparisons of performance of different fixed choices of qs; here, a fixed choice is obtained by setting fr=0.
If a pair difference in y is zero, it falls in the lowest quantile of pairs and therefore receives weight zero along with other pair differences with small |y|.
T |
The test statistic |
comp2 |
The sharp upper bound on the one-sided, exact P-value testing the null hypothesis of no treatment effect in the presence of a bias in treatment assignment of at most gamma. |
scores |
A vector reminding you of the scores, fscore, that you may have attached to the levels of f. |
table |
A table showing how individual categories contribute to the overall test. The notation in this table is from Rosenbaum (2019). |
summary |
A text summary of the conclusion. |
Paul R. Rosenbaum
Brown, B. M. (1981). Symmetric quantile averages and related estimators. Biometrika, 68(1), 235-242.
Lalive, R., Van Ours, J., & Zweimüller, J. (2006). How changes in financial incentives affect the duration of unemployment. The Review of Economic Studies, 73, 1009-1038.
Markowski, E. P., Hettmansperger, T. P. (1982). Inference based on simple rank step score statistics for the location model. Journal of the American Statistical Association, 77(380), 901-907.
Noether, G. E. (1973). Some simple distribution-free confidence intervals for the center of a symmetric distribution. Journal of the American Statistical Association, 68(343), 716-719.
Rosenbaum, P. R. (1999). Using quantile averages in matched observational studies. Journal of the Royal Statistical Society: Series C (Applied Statistics), 48(1), 63-78. <doi.org/10.1111/1467-9876.00140>
Rosenbaum, P. R. and Silber, J. H. (2009) Amplification of sensitivity analysis in observational studies. Journal of the American Statistical Association, 104, 1398-1405. <doi:10.1198/jasa.2009.tm08470>
Rosenbaum, P. R. (2010) The power of a sensitivity analysis and its limit. Chapter 14 of Design of Observational Studies. NY: Springer. <doi:10.1007/978-1-4419-1213-8_14>
Rosenbaum, P. R. (2015). Bahadur efficiency of sensitivity analyses in observational studies. Journal of the American Statistical Association, 110(509), 205-217. <doi.org/10.1080/01621459.2014.960968>
Rosenbaum, P. R. (2017). Observation and Experiment: An Introduction to Causal Inference. Cambridge, MA: Harvard University Press.
Rosenbaum, P. R. (2019). A highly adaptive test for matched observational studies. Manuscript.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # First example is from Rosenbaum (2019)
data("lalive")
attach(lalive)
y<-log2((1+dur[after==1])/52)-log2((1+dur[after==0])/52)
dstat(y,qs=c(1/3,2/3),fr=0,gamma=1.15) # Brown's (1981) test
dstat(y,qs=c(2/3),fr=0,gamma=1.25) # Noether's (1973) Test
#Amplification: see Rosenbaum and Silber (2009), Rosenbaum (2017, Table 9.1)
amplify(1.25,2)
bothseasonal<-(2==(seasonal[after==1]+seasonal[after==0]))*1
bothseasonal<-factor(bothseasonal,levels=1:0,
labels=c("S","O"),ordered=TRUE)
straddle<-1*((pmin(dur[after==1],dur[after==0])<=(bdur[after==0]))
&(pmax(dur[after==1],dur[after==0])>(bdur[after==0])))
straddle<-factor(straddle,levels=c(0,1),
labels=c("N","Y"),ordered=TRUE)
dose<-1*((bdur[after==1]-bdur[after==0])>9.5)
dose<-factor(dose,levels=c(0,1),
labels=c("L","H"),ordered=TRUE)
f<-bothseasonal:dose:straddle
dstat(y,qs=c(1/3,2/3),f=f,gamma=1.25)
# Reproduces Table 2 in Rosenbaum (2019)
dstat(y,qs=c(1/3,2/3),f=f,gamma=1.45)
amplify(1.45,c(2,2.5,3,4))
# Doubling the weight for high-dose matched pairs
levels(f)
fs<-c(1,1,2,2,1,1,2,2)
dstat(y,qs=c(1/3,2/3),f=f,fscore=fs,gamma=1.45)
rm(y,f,dose,straddle,bothseasonal)
detach(lalive)
rm(lalive)
# Second example uses dental data
data(dental)
attach(dental)
f<-age:dose
levels(f)
# Doubles the weight at high dose using fscore
# For qs = (.4,.8), see Markowski and Hettmansperger (1982)
dstat(y,qs=c(.4,.8),gamma=4.25,f=f,fscore=c(1,2,1,2))
rm(f)
detach(dental)
rm(dental)
|
$T
[1] 791
$pval
[1] 0.02633016
$scores
NULL
$table
B I b A w B/I prob
[0,0.762] 218 464 0 1 0 0.470 0.535
(0.762,1.81] 231 463 0 1 1 0.499 0.535
(1.81,8] 280 464 0 1 2 0.603 0.535
$summary
[1] "H0 is rejected at level 0.05 in the presence of a bias of at most Gamma= 1.15"
$T
[1] 280
$pval
[1] 0.02087299
$scores
NULL
$table
B I b A w B/I prob
[0,1.81] 449 927 0 1 0 0.484 0.556
(1.81,8] 280 464 0 1 1 0.603 0.556
$summary
[1] "H0 is rejected at level 0.05 in the presence of a bias of at most Gamma= 1.25"
2
2
$T
[1] 391
$pval
[1] 0.001118555
$scores
S:L:N S:L:Y S:H:N S:H:Y O:L:N O:L:Y O:H:N O:H:Y
1 1 1 1 1 1 1 1
$table
B I b A w B/I prob
S:L:N:[0,0.762] 42 83 47 0 0 0.506 0.556
S:L:N:(0.762,1.81] 51 97 54 0 1 0.526 0.556
S:L:N:(1.81,8] 21 53 30 0 2 0.396 0.556
S:L:Y:[0,0.762] 2 5 3 0 0 0.400 0.556
S:L:Y:(0.762,1.81] 6 12 7 0 1 0.500 0.556
S:L:Y:(1.81,8] 18 29 17 1 2 0.621 0.556
S:H:N:[0,0.762] 17 47 27 0 0 0.362 0.556
S:H:N:(0.762,1.81] 10 32 18 0 1 0.312 0.556
S:H:N:(1.81,8] 8 16 9 0 2 0.500 0.556
S:H:Y:[0,0.762] 4 5 3 1 0 0.800 0.556
S:H:Y:(0.762,1.81] 7 11 7 1 1 0.636 0.556
S:H:Y:(1.81,8] 20 23 13 1 2 0.870 0.556
O:L:N:[0,0.762] 88 197 110 0 0 0.447 0.556
O:L:N:(0.762,1.81] 85 171 95 0 1 0.497 0.556
O:L:N:(1.81,8] 69 127 71 0 2 0.543 0.556
O:L:Y:[0,0.762] 9 19 11 0 0 0.474 0.556
O:L:Y:(0.762,1.81] 30 59 33 0 1 0.508 0.556
O:L:Y:(1.81,8] 82 125 70 1 2 0.656 0.556
O:H:N:[0,0.762] 47 94 53 0 0 0.500 0.556
O:H:N:(0.762,1.81] 22 45 25 0 1 0.489 0.556
O:H:N:(1.81,8] 17 25 14 1 2 0.680 0.556
O:H:Y:[0,0.762] 9 14 8 1 0 0.643 0.556
O:H:Y:(0.762,1.81] 20 36 20 1 1 0.556 0.556
O:H:Y:(1.81,8] 45 66 37 1 2 0.682 0.556
$summary
[1] "H0 is rejected at level 0.05 in the presence of a bias of at most Gamma= 1.25"
$T
[1] 371
$pval
[1] 0.03955181
$scores
S:L:N S:L:Y S:H:N S:H:Y O:L:N O:L:Y O:H:N O:H:Y
1 1 1 1 1 1 1 1
$table
B I b A w B/I prob
S:L:N:[0,0.762] 42 83 50 0 0 0.506 0.592
S:L:N:(0.762,1.81] 51 97 58 0 1 0.526 0.592
S:L:N:(1.81,8] 21 53 32 0 2 0.396 0.592
S:L:Y:[0,0.762] 2 5 3 0 0 0.400 0.592
S:L:Y:(0.762,1.81] 6 12 8 0 1 0.500 0.592
S:L:Y:(1.81,8] 18 29 18 1 2 0.621 0.592
S:H:N:[0,0.762] 17 47 28 0 0 0.362 0.592
S:H:N:(0.762,1.81] 10 32 19 0 1 0.312 0.592
S:H:N:(1.81,8] 8 16 10 0 2 0.500 0.592
S:H:Y:[0,0.762] 4 5 3 1 0 0.800 0.592
S:H:Y:(0.762,1.81] 7 11 7 1 1 0.636 0.592
S:H:Y:(1.81,8] 20 23 14 1 2 0.870 0.592
O:L:N:[0,0.762] 88 197 117 0 0 0.447 0.592
O:L:N:(0.762,1.81] 85 171 102 0 1 0.497 0.592
O:L:N:(1.81,8] 69 127 76 0 2 0.543 0.592
O:L:Y:[0,0.762] 9 19 12 0 0 0.474 0.592
O:L:Y:(0.762,1.81] 30 59 35 0 1 0.508 0.592
O:L:Y:(1.81,8] 82 125 74 1 2 0.656 0.592
O:H:N:[0,0.762] 47 94 56 0 0 0.500 0.592
O:H:N:(0.762,1.81] 22 45 27 0 1 0.489 0.592
O:H:N:(1.81,8] 17 25 15 1 2 0.680 0.592
O:H:Y:[0,0.762] 9 14 9 1 0 0.643 0.592
O:H:Y:(0.762,1.81] 20 36 22 0 1 0.556 0.592
O:H:Y:(1.81,8] 45 66 40 1 2 0.682 0.592
$summary
[1] "H0 is rejected at level 0.05 in the presence of a bias of at most Gamma= 1.45"
2 2.5 3 4
3.454545 2.500000 2.161290 1.882353
[1] "S:L:N" "S:L:Y" "S:H:N" "S:H:Y" "O:L:N" "O:L:Y" "O:H:N" "O:H:Y"
$T
[1] 542
$pval
[1] 0.02185204
$scores
S:L:N S:L:Y S:H:N S:H:Y O:L:N O:L:Y O:H:N O:H:Y
1 1 2 2 1 1 2 2
$table
B I b A w B/I prob
S:L:N:[0,0.762] 42 83 50 0 0 0.506 0.592
S:L:N:(0.762,1.81] 51 97 58 0 1 0.526 0.592
S:L:N:(1.81,8] 21 53 32 0 2 0.396 0.592
S:L:Y:[0,0.762] 2 5 3 0 0 0.400 0.592
S:L:Y:(0.762,1.81] 6 12 8 0 1 0.500 0.592
S:L:Y:(1.81,8] 18 29 18 1 2 0.621 0.592
S:H:N:[0,0.762] 17 47 28 0 0 0.362 0.592
S:H:N:(0.762,1.81] 10 32 19 0 2 0.312 0.592
S:H:N:(1.81,8] 8 16 10 0 4 0.500 0.592
S:H:Y:[0,0.762] 4 5 3 1 0 0.800 0.592
S:H:Y:(0.762,1.81] 7 11 7 1 2 0.636 0.592
S:H:Y:(1.81,8] 20 23 14 1 4 0.870 0.592
O:L:N:[0,0.762] 88 197 117 0 0 0.447 0.592
O:L:N:(0.762,1.81] 85 171 102 0 1 0.497 0.592
O:L:N:(1.81,8] 69 127 76 0 2 0.543 0.592
O:L:Y:[0,0.762] 9 19 12 0 0 0.474 0.592
O:L:Y:(0.762,1.81] 30 59 35 0 1 0.508 0.592
O:L:Y:(1.81,8] 82 125 74 1 2 0.656 0.592
O:H:N:[0,0.762] 47 94 56 0 0 0.500 0.592
O:H:N:(0.762,1.81] 22 45 27 0 2 0.489 0.592
O:H:N:(1.81,8] 17 25 15 1 4 0.680 0.592
O:H:Y:[0,0.762] 9 14 9 1 0 0.643 0.592
O:H:Y:(0.762,1.81] 20 36 22 0 2 0.556 0.592
O:H:Y:(1.81,8] 45 66 40 1 4 0.682 0.592
$summary
[1] "H0 is rejected at level 0.05 in the presence of a bias of at most Gamma= 1.45"
[1] "<= 50:<10" "<= 50:>=10" "> 50:<10" "> 50:>=10"
$T
[1] 268
$pval
[1] 0.01670882
$scores
<= 50:<10 <= 50:>=10 > 50:<10 > 50:>=10
1 2 1 2
$table
B I b A w B/I prob
<= 50:<10:[0,7.99] 18 35 29 0 0 0.514 0.81
<= 50:<10:(7.99,48.6] 21 40 33 0 1 0.525 0.81
<= 50:<10:(48.6,100] 7 9 8 0 2 0.778 0.81
<= 50:>=10:[0,7.99] 31 94 77 0 0 0.330 0.81
<= 50:>=10:(7.99,48.6] 47 64 52 0 2 0.734 0.81
<= 50:>=10:(48.6,100] 21 21 17 1 4 1.000 0.81
> 50:<10:[0,7.99] 11 22 18 0 0 0.500 0.81
> 50:<10:(7.99,48.6] 20 25 21 0 1 0.800 0.81
> 50:<10:(48.6,100] 12 13 11 1 2 0.923 0.81
> 50:>=10:[0,7.99] 19 26 22 0 0 0.731 0.81
> 50:>=10:(7.99,48.6] 38 47 39 0 2 0.809 0.81
> 50:>=10:(48.6,100] 40 45 37 1 4 0.889 0.81
$summary
[1] "H0 is rejected at level 0.05 in the presence of a bias of at most Gamma= 4.25"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.