riskdiff.table {catfun} | R Documentation |
Risk difference
Description
Calculate risk difference and 95 percent confidence interval using Wald method.
Usage
## S3 method for class 'table'
riskdiff(df, conf.level = 0.95, rev = c("neither",
"rows", "columns", "both"), ...)
Arguments
df |
a 2 x 2 frequency table. |
conf.level |
confidence level for confidence interval, default is 0.95. |
rev |
reverse order of cells. Options are "row", "columns", "both", and "neither" (default). |
... |
further arguments passed to or from other methods. |
Value
a list with class "rdiff" containing the following components:
rd |
risk difference |
conf.level |
specified confidence level |
ci |
calculated confidence interval |
p1 |
proportion one |
p2 |
proportion two |
tab |
2x2 table using for calculating risk difference |
Examples
trial <- data.frame(
disease = c(rep("yes", 2), rep("no", 2)),
treatment = c(rep(c("estrogen", "placebo"), 2)),
count = c(751, 623, 7755, 7479))
xtabs(count ~ treatment + disease, data = trial) %>% riskdiff()
[Package catfun version 0.1.4 Index]