# Examples

library(UniExactFunTest)

## Ice cream and food-borne disease

Data source: Stephanie Glen. “Contingency Table: What is it used for?” From StatisticsHowTo.com: Elementary Statistics for the rest of us! https://www.statisticshowto.com/what-is-a-contingency-table/

x <- matrix(c(
13, 32,
17, 23
), nrow=2, byrow=TRUE,
dimnames = list(
c("Ice cream eaten", "No ice cream"),
c("Cases", "Controls")
))
knitr::kable(x)
Cases Controls
Ice cream eaten 13 32
No ice cream 17 23
UEFT(x)
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  x
#> statistic = 1.5693, p-value = 0.2189
#> sample estimates:
#> statistic
#>  1.569281
UEFT(t(x))
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  t(x)
#> statistic = 1.7119, p-value = 0.1997
#> sample estimates:
#> statistic
#>  1.711943

## AIDS and sexual preference

Data source: Stephanie Glen. “Contingency Table: What is it used for?” From StatisticsHowTo.com: Elementary Statistics for the rest of us! https://www.statisticshowto.com/what-is-a-contingency-table/

x <- matrix(
c(4,2,3,3,16,2), nrow=2, ncol=3, byrow=TRUE,
dimnames=list(
c("AIDS: yes", "AIDS: no"),
c("Males", "Females", "Both")
))
knitr::kable(x)
Males Females Both
AIDS: yes 4 2 3
AIDS: no 3 16 2
UEFT(x)
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  x
#> statistic = 8.2952, p-value = 0.03682
#> sample estimates:
#> statistic
#>  8.295238
UEFT(t(x))
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  t(x)
#> statistic = 6.4317, p-value = 0.01705
#> sample estimates:
#> statistic
#>  6.431746

## Cancer therapy

Data source: Mendenhall, W. M., Million, R. R., Sharkey, D. E., & Cassisi, N. J. (1984). Stage T3 squamous cell carcinoma of the glottic larynx treated with surgery and/or radiation therapy. International journal of radiation oncology, biology, physics, 10(3), 357–363. https://doi.org/10.1016/0360-3016(84)90054-3

x <- matrix(c(
21, 2,
15, 3
), nrow=2, byrow=TRUE,
dimnames = list(
c("Cancer controlled", "Cancer not controlled")
))
knitr::kable(x)
Cancer controlled Cancer not controlled
Surgery 21 2
UEFT(x)
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  x
#> statistic = 0.25663, p-value = 0.6301
#> sample estimates:
#> statistic
#> 0.2566278
UEFT(t(x))
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  t(x)
#> statistic = 0.59024, p-value = 0.4534
#> sample estimates:
#> statistic
#> 0.5902439

## Sex and handedness

Data source: https://en.wikipedia.org/wiki/Contingency_table

x <- matrix(c(
43, 9,
44, 4
), nrow=2, byrow=TRUE,
dimnames = list(
c("Male", "Female"),
c("Right-handed", "Left-handed")
))
knitr::kable(x)
Right-handed Left-handed
Male 43 9
Female 44 4
UEFT(x)
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  x
#> statistic = 0.8041, p-value = 0.3933
#> sample estimates:
#> statistic
#> 0.8041026
UEFT(t(x))
#>
#>  Uniform Exact functional test with continuity correction
#>
#> data:  t(x)
#> statistic = 1.7746, p-value = 0.2025
#> sample estimates:
#> statistic
#>  1.774571