episensr also uses the pipe function, %>%
to turn
function composition into a series of imperative statements.
Examples
# Instead of
misclassification(matrix(c(118, 832, 103, 884),
dimnames = list(c("BC+", "BC-"), c("AD+", "AD-")), nrow = 2, byrow = TRUE),
type = "exposure", bias_parms = c(.56, .58, .99, .97))
#> --Observed data--
#> Outcome: BC+
#> Comparing: AD+ vs. AD-
#>
#> AD+ AD-
#> BC+ 118 832
#> BC- 103 884
#>
#> 2.5% 97.5%
#> Observed Relative Risk: 1.1012443 0.9646019 1.2572431
#> Observed Odds Ratio: 1.2172330 0.9192874 1.6117443
#> ---
#> 2.5% 97.5%
#> Misclassification Bias Corrected Relative Risk: 1.272939
#> Misclassification Bias Corrected Odds Ratio: 1.676452 1.150577 2.442679
# you can write
dat <- matrix(c(118, 832, 103, 884),
dimnames = list(c("BC+", "BC-"), c("AD+", "AD-")), nrow = 2, byrow = TRUE)
dat %>% misclassification(., type = "exposure", bias_parms = c(.56, .58, .99, .97))
#> --Observed data--
#> Outcome: BC+
#> Comparing: AD+ vs. AD-
#>
#> AD+ AD-
#> BC+ 118 832
#> BC- 103 884
#>
#> 2.5% 97.5%
#> Observed Relative Risk: 1.1012443 0.9646019 1.2572431
#> Observed Odds Ratio: 1.2172330 0.9192874 1.6117443
#> ---
#> 2.5% 97.5%
#> Misclassification Bias Corrected Relative Risk: 1.272939
#> Misclassification Bias Corrected Odds Ratio: 1.676452 1.150577 2.442679
# also for multiple bias:
dat %>%
misclassification(., type = "exposure", bias_parms = c(.56, .58, .99, .97)) %>%
multiple.bias(., bias_function = "selection", bias_parms = c(.73, .61, .82, .76))
#>
#> Multiple bias analysis
#> ---
#>
#> Selection Bias Corrected Relative Risk: 1.192461
#> Selection Bias Corrected Odds Ratio: 1.512206