install.packages(‘epitools’)
library(epitools)
Data Generation
# create matrix for the Readable Survey
textextract <- c('OCR1', 'OCR2')
outcome <- c('Yes', 'No')
survey <- matrix(c(13, 5, 12, 7), nrow=2, ncol=2, byrow=TRUE)
dimnames(survey) <- list('textextract'=textextract, 'Outcome'=outcome)
#view matrix
survey
## Outcome
## textextract Yes No
## OCR1 13 5
## OCR2 12 7
Odds Ratio
oddsratio(survey)
## $data
## Outcome
## textextract Yes No Total
## OCR1 13 5 18
## OCR2 12 7 19
## Total 25 12 37
##
## $measure
## odds ratio with 95% C.I.
## textextract estimate lower upper
## OCR1 1.000000 NA NA
## OCR2 1.490704 0.3633389 6.501572
##
## $p.value
## two-sided
## textextract midp.exact fisher.exact chi.square
## OCR1 NA NA NA
## OCR2 0.5809157 0.7281063 0.5560672
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "median-unbiased estimate & mid-p exact CI"
Risk Ratio
riskratio.wald(survey)
## $data
## Outcome
## textextract Yes No Total
## OCR1 13 5 18
## OCR2 12 7 19
## Total 25 12 37
##
## $measure
## risk ratio with 95% C.I.
## textextract estimate lower upper
## OCR1 1.000000 NA NA
## OCR2 1.326316 0.5132176 3.427618
##
## $p.value
## two-sided
## textextract midp.exact fisher.exact chi.square
## OCR1 NA NA NA
## OCR2 0.5809157 0.7281063 0.5560672
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
χ2
chisq.test(survey)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: survey
## X-squared = 0.056347, df = 1, p-value = 0.8124