Exact unconditional test for association in 2x2 tables

Described in Chapter 4 "The 2x2 Table"

Exact_unconditional_test_2x2(n, statistic = "Pearson", gamma = 1e-04)

Arguments

n

the observed counts (a 2x2 matrix)

statistic

'Pearson' (Suissa-Shuster test default), 'LR' (likelihood ratio), ' unpooled' (unpooled Z), or 'Fisher' (Fisher-Boschloo test)

gamma

parameter for the Berger and Boos procedure (default=0.0001 gamma=0: no adj)

Value

An object of the contingencytables_result class, basically a subclass of base::list(). Use the utils::str() function to see the specific elements returned.

Note

Somewhat crude code with maximization over a simple partition of the nuisance parameter space into 'num_pi_values' equally spaced values (1000, hardcoded). This method could be improved with a better algorithm for the maximization however, it works well for most purposes. plot() the results to get an indication of the precision. A refinement of the maximization can be done with a manual restriction of the parameter space.

Examples

Exact_unconditional_test_2x2(tea)
#> The Suissa-Shuster exact unconditional test: P = 0.28916
Exact_unconditional_test_2x2(perondi_2004)
#> The Suissa-Shuster exact unconditional test: P = 0.02821
Exact_unconditional_test_2x2(lampasona_2013)
#> The Suissa-Shuster exact unconditional test: P = 0.05238
Exact_unconditional_test_2x2(ritland_2007)
#> The Suissa-Shuster exact unconditional test: P = 0.04992