| FisherSens | R Documentation |
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).
FisherSens(totalN, treatedN, totalSuccesses, treatedSuccesses, Gammas)
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 |
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.
Devin Caughey, MIT, caughey@mit.edu
See also binarysens,
hlsens,
mcontrol
## 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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.