riskdiff.table: Risk difference

Description Usage Arguments Value Examples

Description

Calculate risk difference and 95 percent confidence interval using Wald method.

Usage

1
2
3
## 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

1
2
3
4
5
6
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()

catfun documentation built on June 14, 2019, 5:04 p.m.