Skip to contents

This assumes positive disease counts are stratified by a population grouping, e.g. geography or age, and we have estimates of the size of that population during that time period. Normalising by population size allows us to compare groups.

Usage

normalise_incidence.proportion(
  modelled = i_proportion_model,
  ...,
  population_unit = 1e+05,
  normalise_time = FALSE
)

Arguments

modelled

Model output from processing the raw dataframe with something like poission_locfit_model

A dataframe containing the following columns:

  • time (as.time_period + group_unique) - A (usually complete) set of singular observations per unit time as a `time_period`

  • proportion.fit (double) - an estimate of the proportion on a logit scale

  • proportion.se.fit (double) - the standard error of proportion estimate on a logit scale

  • proportion.0.025 (proportion) - lower confidence limit of proportion (true scale)

  • proportion.0.5 (proportion) - median estimate of proportion (true scale)

  • proportion.0.975 (proportion) - upper confidence limit of proportion (true scale)

No mandatory groupings.

No default value.

...

not used

population_unit

what population unit do you want the incidence in e.g. per 100K

normalise_time

The default behaviour for incidence is to keep it in the same time units as the input data. If this parameter is set to TRUE the incidence rates are calculated per year. If given as a lubridate period string e.g. "1 day" then the incidence is calculated over that time period.

Value

a dataframe with incidence rates per unit capita. A dataframe containing the following columns:

  • time (as.time_period + group_unique) - A (usually complete) set of singular observations per unit time as a time_period

  • incidence.per_capita.fit (double) - an estimate of the incidence per capita rate on a log scale

  • incidence.per_capita.se.fit (double) - the standard error of the incidence per capita rate estimate on a log scale

  • incidence.per_capita.0.025 (positive_double) - lower confidence limit of the incidence per capita rate (true scale)

  • incidence.per_capita.0.5 (positive_double) - median estimate of the incidence per capita rate (true scale)

  • incidence.per_capita.0.975 (positive_double) - upper confidence limit of the incidence per capita rate (true scale)

  • population_unit (double) - The population unit on which the per capita incidence rate is calculated

No mandatory groupings.

No default value.

Details

This scales a proportion model by the population unit to make it comparable to an incidence model.

Examples

tmp = growthrates::england_covid %>%
  growthrates::poisson_locfit_model(window=21) %>%
  growthrates::normalise_incidence(growthrates::england_demographics) %>%
  dplyr::glimpse()
#> Rows: 26,790
#> Columns: 21
#> Groups: class [19]
#> $ class                       <fct> 00_04, 00_04, 00_04, 00_04, 00_04, 00_04, …
#> $ time                        <time_prd> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,…
#> $ incidence.fit               <dbl> -17.891227, -17.395804, -16.873590, -16.33…
#> $ incidence.se.fit            <dbl> 1.9111699, 1.9238465, 1.9194060, 1.9000358…
#> $ incidence.0.025             <dbl> 4.010032e-10, 6.419738e-10, 1.091671e-09, …
#> $ incidence.0.5               <dbl> 1.698004e-08, 2.786752e-08, 4.697785e-08, …
#> $ incidence.0.975             <dbl> 7.190010e-07, 1.209705e-06, 2.021596e-06, …
#> $ growth.fit                  <dbl> 0.4798757, 0.4792888, 0.4776793, 0.4752744…
#> $ growth.se.fit               <dbl> 0.05395200, 0.05584978, 0.05729669, 0.0583…
#> $ growth.0.025                <dbl> 0.3741317, 0.3698252, 0.3653799, 0.3609097…
#> $ growth.0.5                  <dbl> 0.4798757, 0.4792888, 0.4776793, 0.4752744…
#> $ growth.0.975                <dbl> 0.5856197, 0.5887523, 0.5899788, 0.5896391…
#> $ population                  <int> 3077000, 3077000, 3077000, 3077000, 307700…
#> $ baseline_proportion         <dbl> 0.05447011, 0.05447011, 0.05447011, 0.0544…
#> $ incidence.per_capita.0.025  <dbl> 1.303228e-11, 2.086363e-11, 3.547843e-11, …
#> $ incidence.per_capita.0.5    <dbl> 5.518375e-10, 9.056719e-10, 1.526742e-09, …
#> $ incidence.per_capita.0.975  <dbl> 2.336695e-08, 3.931443e-08, 6.570024e-08, …
#> $ incidence.per_capita.fit    <dbl> -21.317768, -20.822344, -20.300130, -19.75…
#> $ incidence.per_capita.se.fit <dbl> -1.515370, -1.502694, -1.507134, -1.526504…
#> $ population_unit             <dbl> 1e+05, 1e+05, 1e+05, 1e+05, 1e+05, 1e+05, …
#> $ time_unit                   <Period> 1d 0H 0M 0S, 1d 0H 0M 0S, 1d 0H 0M 0S, …