Description Usage Arguments Details Value References
In addition to measures of effect such as odds ratio, risk ratio, and risk difference, the twoxtwo framework allows for calculation of attributable fractions: attributable risk proportion in the exposed (ARP) and the population attributable risk proportion (PARP).
Estimates of the attributable fractions can be calculated with the arp()
and parp()
functions respectively. Each function takes an input dataset and arguments for outcome and exposure as bare, unquoted variable names. If the input has the twoxtwo class then the effect measures will be calculated using exposure and outcome information from that object. The functions all return a tidy tibble
with the name of the measure, the point estimate, and lower/upper bounds of a confidence interval (CI) based on the SE.
Formulas used in point estimate and SE calculations are available in 'Details'.
1 2 3 4 5 6 7 8 9 10 11 |
.data |
Either a data frame with observation-level exposure and outcome data or a twoxtwo object |
exposure |
Name of exposure variable; ignored if input to |
outcome |
Name of outcome variable; ignored if input to |
alpha |
Significance level to be used for constructing confidence interval; default is |
percent |
Logical as to whether or not the measure should be returned as a percentage; default is |
... |
Additional arguments passed to twoxtwo function; ignored if input to |
prevalence |
Prevalence of exposure in the population; must be numeric between |
The formulas below denote cell values as A,B,C,D. For more on twoxtwo
notation see the twoxtwo documentation.
Note that formulas for standard errors are not provided below but are based on forumlas described in Hildebrandt et al (2006).
ARP = 1 - (1/((A/(A+B)) / (C/(C+D))))
PARP = (((A+C)/(A+B+C+D))-(C/(C+D)))) / ((A+C)/(A+B+C+D))
If "prevalence" argument is not NULL
then the formula uses the value specified for prevalence of exposure (p):
PARP = p * (((A/(A+B)) / (C/(C+D))) - 1) / (p * (((A/(A+B)) / (C/(C+D))) - 1) + 1)
A tibble
with the following columns:
measure: Name of the measure calculated
estimate: Point estimate for the effect measure
ci_lower: The lower bound of the confidence interval for the estimate
ci_upper: The upper bound of the confidence interval for the estimate
exposure: Name of the exposure variable followed by +/- levels (e.g. smoking::yes/no)
outcome: Name of the outcome variable followed by +/- levels (e.g. heart_disease::yes/no)
Hildebrandt, M., Bender, R., Gehrmann, U., & Blettner, M. (2006). Calculating confidence intervals for impact numbers. BMC medical research methodology, 6, 32. https://doi.org/10.1186/1471-2288-6-32
Szklo, M., & Nieto, F. J. (2007). Epidemiology: Beyond the basics. Sudbury, Massachussets: Jones and Bartlett.
Zapata-Diomedi, B., Barendregt, J. J., & Veerman, J. L. (2018). Population attributable fraction: names, types and issues with incorrect interpretation of relative risks. British journal of sports medicine, 52(4), 212–213. https://doi.org/10.1136/bjsports-2015-095531
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.