riskratio(x, y = NULL,
method = c("wald", "small", "boot"),
conf.level = 0.95,
rev = c("neither", "rows", "columns", "both"),
correction = FALSE,
verbose = FALSE,
replicates = 5000)
riskratio.wald(x, y = NULL,
conf.level = 0.95,
rev = c("neither", "rows", "columns", "both"),
correction = FALSE,
verbose = FALSE)
riskratio.small(x, y = NULL,
conf.level = 0.95,
rev = c("neither", "rows", "columns", "both"),
correction = FALSE,
verbose = FALSE)
riskratio.boot(x, y = NULL,
conf.level = 0.95,
rev = c("neither", "rows", "columns", "both"),
correction = FALSE,
verbose = FALSE,
replicates = 5000)
y
into a table.x
into a table (default is NULL)
x
but with marginal totalsdisease=0 disease=1 exposed=0 (ref) n00 n01 exposed=1 n10 n11 exposed=2 n20 n21 exposed=3 n30 n31The reason for this is because each level of exposure is compared to the reference level. If you are providing a 2x2 table the following table is preferred:
disease=0 disease=1 exposed=0 (ref) n00 n01 exposed=1 n10 n11If 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 Fisher's Exact, Monte Carlo simulation, and the
chi-square test.tab2by2.test
, oddsratio
,
rateratio
, epitab
##Case-control study assessing whether exposure to tap water
##is associated with cryptosporidiosis among AIDS patients
tapw <- c("Lowest", "Intermediate", "Highest")
outc <- c("Case", "Control")
dat <- matrix(c(2, 29, 35, 64, 12, 6),3,2,byrow=TRUE)
dimnames(dat) <- list("Tap water exposure" = tapw, "Outcome" = outc)
riskratio(dat, rev="c")
riskratio.wald(dat, rev="c")
riskratio.small(dat, rev="c")
##Selvin 1998, p. 289
sel <- matrix(c(178, 79, 1411, 1486), 2, 2)
dimnames(sel) <- list("Behavior type" = c("Type A", "Type B"),
"Outcome" = c("CHD", "No CHD")
)
riskratio.boot(sel, rev = "b")
riskratio.boot(sel, rev = "b", verbose = TRUE)
riskratio(sel, rev = "b", method = "boot")
Run the code above in your browser using DataLab