# For test on contingency table of the pairs
# From Bentur, et al (2009) Pediatric Pulmonology 44:845-850.
# see also Table II of Fagerland, Lydersen and Laake
# (2013, Stat in Med, 33: 2850-2875)
#
# After SCT
# AHR No AHR
# -----------------
# Before SCT |
# AHR | 1 1
# No AHR | 7 12
# -----------------
ahr<-matrix(c(1,7,1,12),2,2,
dimnames=list(paste("Before SCT,",c("AHR","No AHR")),
paste("After SCT,",c("AHR","No AHR"))))
mcnemarExactDP(n=sum(ahr),m=ahr[1,2]+ahr[2,1], x=ahr[1,2])
# compare to mcnemar.exact
# same p-value, but mcnemar.exact gives conf int on odds ratio
mcnemar.exact(ahr)
Run the code above in your browser using DataLab