FisherSens: Rosenbaum Sensitivity Analysis for Fisher's Exact Test

View source: R/FisherSens.R

FisherSensR Documentation

Rosenbaum Sensitivity Analysis for Fisher's Exact Test

Description

Calculates sensitivity to hidden bias for Fisher's exact test for a two-by-two contingency table, following the method described in Rosenbaum (2002, sec. 4.4).

Usage

FisherSens(totalN, treatedN, totalSuccesses, treatedSuccesses, Gammas)

Arguments

totalN

total number of observations

treatedN

number of treated observations

totalSuccesses

total number of “successes”

treatedSuccesses

number of successes in treatment group

Gammas

vector of Gammas (bounds on the differential odds of treatment) at which to test the significance of the results

Value

Returns a matrix with three columns and number of rows equal to the length of "Gammas". Each row indicates the upper and lower bounds for the (one-sided) p-value for a given value of Gamma.

Author(s)

Devin Caughey, MIT, caughey@mit.edu

See Also

See also binarysens, hlsens, mcontrol

Examples

## Fisher's Lady Tasting Tea: milk first or tea first?
LadyTastingTea <- matrix(c(4, 0, 0, 4), nrow = 2,
                         dimnames = list(Guess = c("Milk", "Tea"),
                                         Truth = c("Milk", "Tea")))
## Define "Milk" as "treated"/"success"
FisherSens(totalN = sum(LadyTastingTea), 
           treatedN = sum(LadyTastingTea["Milk", ]),
           totalSuccesses = sum(LadyTastingTea[, "Milk"]), 
           treatedSuccesses = sum(LadyTastingTea["Milk", "Milk"]), 
           Gammas = seq(1, 2, .2))
## Interpretation: Rejection of the null hypothesis 
## (that the lady cannot discriminate between milk-first and tea-first) 
## is insensitive to bias as large as Gamma = 2.

rbounds documentation built on April 30, 2022, 1:07 a.m.

Related to FisherSens in rbounds...