Calculates odds ratio by median-unbiased estimation (mid-p),
conditional maximum likelihood estimation (Fisher), unconditional
maximum likelihood estimation (Wald), and small sample adjustment
(small). Confidence intervals are calculated using exact methods
(mid-p and Fisher), normal approximation (Wald), and normal
approximation with small sample adjustment (small).
input data can be one of the following: r x 2 table, vector
of numbers from a contigency table (will be transformed into r x 2
table in row-wise order), or single factor or character vector that
will be combined with y into a table.
y
single factor or character vector that will be combined with
x into a table (default is NULL)
method
method for calculating odds ratio and confidence interval
conf.level
confidence level (default is 0.95)
rev
reverse order of "rows", "colums", "both", or "neither" (default)
correction
set to TRUE for Yate's continuity correction (default is FALSE)
verbose
set to TRUE to return more detailed results (default is
FALSE)
interval
interval for the uniroot that finds the
odds ratio median-unbiased estimate and mid-p exact confidence
interval for oddsratio.midp
...
passes optional arguments to tab2by2.test for
calculatng tests of independence (p values): adding correction
= TRUE implements Yate's continuity correction (default is FALSE),
and adding replicates = n where n is an integer
specifying the number of iterations (default is 2000) of the Monte
Carlo simulation method of calculating p values.
Details
Calculates odds ratio by median-unbiased estimation (mid-p),
conditional maximum likelihood estimation (Fisher), unconditional
maximum likelihood estimation (Wald), and small sample adjustment
(small). Confidence intervals are calculated using
exact methods (mid-p and Fisher), normal approximation (Wald), and
normal approximation with small sample adjustment (small).
This function expects the following table struture:
If the table you want to provide to this function is not in the
preferred form, just use the rev option to "reverse" the rows,
columns, or both. If you are providing categorical variables (factors
or character vectors), the first level of the "exposure" variable is
treated as the reference. However, you can set the reference of a
factor using the relevel function.
Likewise, each row of the rx2 table is compared to the exposure
reference level and test of independence two-sided p values are
calculated using mid-p exact, Fisher's Exact, Monte Carlo simulation,
and the chi-square test.
Value
x
table that was used in analysis (verbose = TRUE)
data
same table as x but with marginal totals
p.exposed
proportions exposed (verbose = TRUE)
p.outcome
proportions experienced outcome (verbose = TRUE)
measure
risk ratio and confidence interval
conf.level
confidence level used (verbose = TRUE)
p.value
p value for test of independence
replicates
number of replicates used in Monte Carlo simulation
p value (verbose = TRUE)
correction
logical specifying if continuity correction was used