# NOT RUN {
# Reproduces parts of Table 5.3 from Design of Observational Studies
data(angristlavy)
attach(angristlavy)
cohere(cbind(avgmath,avgverb),1-z,pair,w=c(1,1),apriori=TRUE)
cohere(cbind(avgmath,avgverb),1-z,pair,w=c(1,0),apriori=TRUE)
cohere(cbind(avgmath,avgverb),1-z,pair,w=c(0,1),apriori=TRUE)
cohere(cbind(avgmath,avgverb),1-z,pair,w=c(1,1),gamma=1.65,apriori=TRUE)
# Uses the technique in Rosenbaum (2019)
# Rejection occurs at gamma=1.5 as 2.054>1.895
cohere(cbind(avgmath,avgverb),1-z,pair,w=c(1,1),gamma=1.5)
planScheffe(2)
detach(angristlavy)
data(teeth)
attach(teeth)
# Coherent Wilcoxon signed rank test
cohere(cbind(either4up,either4low),smoker,mset,apriori=TRUE)
# Sensitivity analysis, gamma=2
cohere(cbind(either4up,either4low),smoker,mset,
gamma=2,apriori=TRUE)
# Upper teeth only
cohere(cbind(either4up,either4low),smoker,mset,
w=c(1,0),gamma=2,apriori=TRUE)
# This is the same as the univariate test
y<-either4up[smoker==1]-either4up[smoker==0]
senWilcox(y,gamma=2)
# Try various weights, correcting by Scheffe's method
cohere(cbind(either4up,either4low),smoker,mset,
w=c(1,2),gamma=2,Scheffe=TRUE)
# Replace Wilcoxon's ranks with the new U-statistic
cohere(cbind(either4up,either4low),smoker,mset,
w=c(1,2),gamma=2,Scheffe=TRUE,m=8,m1=6,m2=8)
detach(teeth)
# }
Run the code above in your browser using DataLab