These functions calculate the sample size needed to estimate a measure with a certain precision. 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.

n_risk_difference(precision, exposed, unexposed, group_ratio, ci = 0.95) n_risk_ratio(precision, exposed, unexposed, group_ratio, ci = 0.95) n_rate_difference(precision, exposed, unexposed, group_ratio, ci = 0.95) n_rate_ratio(precision, exposed, unexposed, group_ratio, ci = 0.95) n_odds_ratio( precision, exposed_cases, exposed_controls, group_ratio, ci = 0.95 )

precision | For differences, the width of the CI. For ratios, the ratio of the upper to lower CI. |
---|---|

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 sample size, effect measure, and precision

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 n_risk_difference( precision = .08, exposed = .4, unexposed = .3, group_ratio = 3, ci = .90 )#> # A tibble: 1 x 9 #> n_exposed n_unexposed n_total risk_difference precision exposed unexposed #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 524. 1573. 2097. 0.1 0.08 0.4 0.3 #> # … with 2 more variables: group_ratio <dbl>, ci <dbl>n_risk_ratio( precision = 2, exposed = .4, unexposed = .3, group_ratio = 3 )#> # A tibble: 1 x 9 #> n_exposed n_unexposed n_total risk_ratio precision exposed unexposed #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 72.8 219. 291. 1.33 2 0.4 0.3 #> # … with 2 more variables: group_ratio <dbl>, ci <dbl>