This enables incidence rates are able to be compared to a baseline figure for
incidence. The baseline could come for example from a population average or
average incidence over time. The output is an incidence rate ratio. The
incidence_baseline
column is a rate of events per unit time. The time unit
is expected to be the same as that of the date in modelled
and this is not
checked.
Arguments
- modelled
Model output from something like
poisson_locfit_model()
. It really makes sense if this is a grouped model. - a dataframe with columns:time (ggoutbreak::time_period + group_unique) - A (usually complete) set of singular observations per unit time as a `time_period`
incidence.fit (double) - an estimate of the incidence rate on a log scale
incidence.se.fit (positive_double) - the standard error of the incidence rate estimate on a log scale
incidence.0.025 (positive_double) - lower confidence limit of the incidence rate (true scale)
incidence.0.5 (positive_double) - median estimate of the incidence rate (true scale)
incidence.0.975 (positive_double) - upper confidence limit of the incidence rate (true scale)
Any grouping allowed.
- base
The baseline data must be grouped in the same way as
modelled
. It may be a time series but does not have to be. See the example and note this may change in the future. - a dataframe with columns:baseline_incidence (positive_double) - Baseline raw incidence rate as count data
Any grouping allowed.
- ...
not used
Value
a dataframe with incidence rate ratios for each of the classes in modelled. A dataframe containing the following columns:
time (ggoutbreak::time_period + group_unique) - A (usually complete) set of singular observations per unit time as a
time_period
rate_ratio.0.025 (positive_double) - lower confidence limit of the rate ratio for a population group
rate_ratio.0.5 (positive_double) - median estimate of the rate ratio for a population group
rate_ratio.0.975 (positive_double) - upper confidence limit of the rate ratio for a population group
Any grouping allowed.
Examples
baseline = ggoutbreak::england_covid_poisson %>%
dplyr::mutate(baseline_incidence = incidence.0.5)
tmp = ggoutbreak::england_covid_poisson_age_stratified %>%
ggoutbreak::infer_rate_ratio(baseline) %>%
dplyr::glimpse()
#> Rows: 26,790
#> Columns: 24
#> Groups: class [19]
#> $ class <fct> 00_04, 00_04, 00_04, 00_04, 00_04, 00_04, 00_04, 00…
#> $ time <time_prd> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, …
#> $ incidence.fit <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, -97…
#> $ incidence.se.fit <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ incidence.0.025 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ incidence.0.05 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ incidence.0.25 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ incidence.0.5 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ incidence.0.75 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ incidence.0.95 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ incidence.0.975 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.fit <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.se.fit <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.0.025 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.0.05 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.0.25 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.0.5 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.0.75 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.0.95 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ growth.0.975 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ baseline_incidence <dbl> 3.1078399, 2.8905742, 2.6931935, 2.5110697, 2.34049…
#> $ rate_ratio.0.025 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ rate_ratio.0.5 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…
#> $ rate_ratio.0.975 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0…