Skip to contents

This uses a generalised linear model to fit a quasi-poisson model with a time varying rate as a natural cubic spline with approx one degree of freedom per window units of the time series.

Usage

poisson_glm_model(d = i_incidence_input, ..., window = 14, frequency = "1 day")

Arguments

d

Count model input

A dataframe containing the following columns:

  • count (positive_integer) - Positive case counts associated with the specified timeframe

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

Ungrouped.

No default value.

...

not used and present to allow proportion model to be used in a group_modify

window

a number of data points defining the bandwidth of the estimate, smaller values result in less smoothing, large value in more. The default value of 14 is calibrated for data provided on a daily frequency, with weekly data a lower value may be preferred. - (defaults to 14)

frequency

the density of the output estimates as a time period such as 7 days or 2 weeks. - (defaults to "1 day")

Value

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.fit (double) - an estimate of the incidence rate on a log scale

  • incidence.se.fit (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)

No mandatory groupings.

No default value.

Examples


tmp = growthrates::england_covid %>%
 growthrates::poisson_glm_model(window=21) %>%
 dplyr::glimpse()
#> Rows: 26,790
#> Columns: 7
#> Groups: class [19]
#> $ class            <fct> 00_04, 00_04, 00_04, 00_04, 00_04, 00_04, 00_04, 00_0…
#> $ time             <time_prd> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14…
#> $ incidence.fit    <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ incidence.se.fit <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ incidence.0.025  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ incidence.0.5    <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ incidence.0.975  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…