Builds a stat_fns function for tbl_custom_summary() that reports the
ratio of two sums, e.g. an event rate over exposure time, with a Poisson
confidence interval. The returned statistics are {num}, {denom},
{ratio}, {conf.low} and {conf.high}; the interval is only computed
when the numerator sum is a whole number.
Value
A function for the stat_fns argument of tbl_custom_summary().
See also
Other custom summaries:
proportion_summary()
Examples
# Example 1 ----------------------------------
# responses per year of follow-up
trial |>
tbl_custom_summary(
include = grade,
stat_fns = ~ratio_summary("response", "ttdeath"),
statistic = ~"{ratio} [{conf.low}; {conf.high}] ({num}/{denom})",
digits = ~c(3, 2, 2, 0, 0)
)