R/precision.R
precision_risk_difference.Rd
These functions calculate the precision of an estimate given a certain sample size. For ratio measures, like the risk ratio, rate ratio, and odds ratio, this is the ratio of the upper to lower limit of the confidence interval. For difference measures, like the risk difference or rate difference, this is the absolute width of the confidence interval.
precision_risk_difference( n_exposed, exposed, unexposed, group_ratio, ci = 0.95 ) precision_risk_ratio(n_exposed, exposed, unexposed, group_ratio, ci = 0.95) precision_rate_difference( n_exposed, exposed, unexposed, group_ratio, ci = 0.95 ) precision_rate_ratio(n_exposed, exposed, unexposed, group_ratio, ci = 0.95) precision_odds_ratio( n_cases, exposed_cases, exposed_controls, group_ratio, ci = 0.95 )
n_exposed, n_cases | In cohort studies, the number of exposed participants. In case-control studies, the number of cases. |
---|---|
exposed | The risk or rate among the exposed cohort. |
unexposed | The risk or rate among the unexposed cohort. |
group_ratio | In cohort studies, the ratio of the unexposed to the exposed. In case-control studies, the ratio of the controls to the cases. |
ci | The confidence interval as a probability or percent. Default is .95. |
exposed_cases | The proportion of exposed cases. |
exposed_controls | The proportion of exposed controls. |
a tibble with precision, effect measure, and sample size
Rothman, K.J. and Greenland, S. 2018. Planning Study Size Based on Precision Rather Than Power. 29(5):599-603.
# From Rothman and Greenland 2018 precision_odds_ratio( n_cases = 500, exposed_cases = .6, exposed_controls = .4, group_ratio = 2 )#> # A tibble: 1 × 9 #> precision odds_ratio n_cases n_controls n_total exposed_cases exposed_controls #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1.55 2.25 500 1000 1500 0.6 0.4 #> # … with 2 more variables: group_ratio <dbl>, ci <dbl>