risk: Calculate risk ratio and risk difference

Description Usage Arguments Value Examples

Description

Calculate risk ratios and risk differences

Usage

1
risk(data, exposure, outcome, ci_level = 95)

Arguments

data

A dataframe

exposure

Variable giving the levels of the outcome

outcome

Variable giving cases (1) or non-cases (0)

ci_level

a string giving the confidence interval

Value

A dataframe with the risk ratio, risk difference and confidence intervals

Examples

1
2
3
4
5
6
7
# Data from stratum 1 of table 15-1., p260
dat <- data.frame(
    exposure_var = c(rep(1, 8), rep(0, 5), rep(1, 98), rep(0, 115)),
  outcome_var = c(rep(1, 8), rep(1, 5), rep(0, 98), rep(0, 115)),
  stringsAsFactors = FALSE
)
risk(data = dat, exposure = exposure_var, outcome = outcome_var)

Example output

# A tibble: 2 x 10
  exposure_var     n outcome  risk risk_ratio rr_lci rr_uci risk_diff rd_lci
         <dbl> <int>   <dbl> <dbl>      <dbl>  <dbl>  <dbl>     <dbl>  <dbl>
1            0   120       5  4.17       1     0.337   2.96      0     -6.20
2            1   106       8  7.55       1.81  0.611   5.37      3.38  -2.82
# ... with 1 more variable: rd_uci <dbl>

episheet documentation built on May 2, 2019, 11:44 a.m.