boschloo: Boschloo's test for 2x2 Tables

Description Usage Arguments Details Value References See Also Examples

View source: R/boschloo.R

Description

Boschloo's test is an exact unconditional test for 2x2 tables based on ordering the sample space by Fisher's exact p-values. This function generalizes that test in several ways (see details).

Usage

1
2
3
boschloo(x1, n1, x2, n2, alternative = c("two.sided", "less", "greater"), 
    or = NULL, conf.int = FALSE, conf.level = 0.95, midp = FALSE, 
    tsmethod = c("central", "minlike"), control=ucControl())

Arguments

x1

number of events in group 1

n1

sample size in group 1

x2

number of events in group 2

n2

sample size in group 2

alternative

alternative hypothesis, one of "two.sided", "less", or "greater", default is "two.sided" (see details)

or

odds ratio under the null hypothesis

conf.int

logical, calculate confidence interval?

conf.level

confidence level

midp

logical. Use mid-p-value method?

tsmethod

two-sided method, either "central" or "minlike" (see details)

control

list of algorithm parameters, see ucControl

Details

The traditional Boschloo (1970) test is to use Fisher's exact p-values (under the null that p1=p2) to order the sample space and to use that ordering to perform an unconditional exact test. Here we generalize this to test for different null hypothesis values (other that odds ratios of 1).

For the two-sided alternatives, the traditional method uses tsmethod='minlike' (for example, in the Exact R package) but our default is tsmethod='central'. The one-sided tests use ordering by the appropriate p-value (or 1 minus the p-value for alternative='greater' so that the ordering function follows our convention for user supplied ordering functions, see method='user' option in uncondExact2x2).

The option midp orders the sample space by the mid-p value associated with Fisher's exact test, and additionally gives mid-p values. This means that unlike the midp=FALSE case, when midp=TRUE the test is not exact (i.e., guaranteed to bound the type I error rate at the nominal level), but has type I error rates that are on average (over the possible null parameter values) closer to the nominal level.

If you want to order by the mid-p values from Fisher's exact test but get an exact test, use the method="FisherAdj" with midp=FALSE in uncondExact2x2.

The boschloo function only gives confidence intervals for the odds ratio, for getting confidence intervals closely related to Boschloo p-values (but not exactly matching Boschloo p-values) for the difference or ratio, use uncondExact2x2 with method="FisherAdj".

Value

a list of class 'htest' with elements:

statistic

proportion in sample 1

parameter

proportion in sample 2

p.value

p-value from test

conf.int

confidence interval on odds ratio

estimate

odds ratio estimate

null.value

null hypothesis value of odds ratio

alternative

alternative hypothesis

method

description of test

data.name

description of data

References

Boschloo, R. D. "Raised conditional level of significance for the 2x2-table when testing the equality of two probabilities." Statistica Neerlandica 24.1 (1970): 1-9.

See Also

exact.test in package Exact for Boschloo test p-value computation. Also see method"FisherAdj" in uncondExact2x2 for a closely related test.

Examples

1
2
3
4
5
# defaults to the central two-sided version
boschloo(1,5,6,7)
boschloo(1,5,6,7,alternative="greater")
## traditional two-sided Boschloo test (not central!)
boschloo(1,5,6,7, tsmethod="minlike")

Example output

Loading required package: exactci
Loading required package: ssanv

	Boschloo's test

data:  x1/n1=(1/5) and x2/n2= (6/7)
proportion 1 = 0.2, proportion 2 = 0.85714, p-value = 0.0348
alternative hypothesis: true p2(1-p1)/[p1(1-p2)] is less than 1
 percent confidence interval:
 NA NA
sample estimates:
p2(1-p1)/[p1(1-p2)] 
                 24 


	Boschloo's test

data:  x1/n1=(1/5) and x2/n2= (6/7)
proportion 1 = 0.2, proportion 2 = 0.85714, p-value = 0.0174
alternative hypothesis: true p2(1-p1)/[p1(1-p2)] is greater than 1
95 percent confidence interval:
 NA NA
sample estimates:
p2(1-p1)/[p1(1-p2)] 
                 24 


	Boschloo's test

data:  x1/n1=(1/5) and x2/n2= (6/7)
proportion 1 = 0.2, proportion 2 = 0.85714, p-value = 0.03857
alternative hypothesis: true p2(1-p1)/[p1(1-p2)] is not equal to 1
95 percent confidence interval:
 NA NA
sample estimates:
p2(1-p1)/[p1(1-p2)] 
                 24 

exact2x2 documentation built on Dec. 11, 2021, 9:43 a.m.