Sometimes we may have, for example, modelled incidence or growth rates on weekly data resulting in cases per week and growth rate per week. We may wish to use this to estimate the reproduction number, using algorithms that assume a daily incidence. Not everything has a dependence on time, and things such as proportions, or prevalence will not change.
Arguments
- df
A data frame containing modelled output. This will modify the following columns if present:
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
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.
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
growth.fit (double) - an estimate of the growth rate
growth.se.fit (positive_double) - the standard error the growth rate
growth.0.025 (double) - lower confidence limit of the growth rate
growth.0.5 (double) - median estimate of the growth rate
growth.0.975 (double) - upper confidence limit of the growth rate
Any grouping allowed.
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
proportion.fit (double) - an estimate of the proportion on a logit scale
proportion.se.fit (positive_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)
relative.growth.fit (double) - an estimate of the relative growth rate
relative.growth.se.fit (positive_double) - the standard error the relative growth rate
relative.growth.0.025 (double) - lower confidence limit of the relative growth rate
relative.growth.0.5 (double) - median estimate of the relative growth rate
relative.growth.0.975 (double) - upper confidence limit of the relative growth rate
Any grouping allowed.
- time_unit
a
lubridate
period string such as "1 day"
Value
the same time series with different time unit, and adjusted incidence and growth rate figures.
Examples
sim = sim_poisson_model(time_unit = "1 week")
incidence = sim %>% poisson_locfit_model(frequency = "1 day", deg = 2, window=5)
incidence2 = incidence %>% rescale_model(time_unit = "1 day")
incidence2 %>% dplyr::glimpse()
#> Rows: 727
#> Columns: 20
#> Groups: statistic [1]
#> $ statistic <chr> "infections", "infections", "infections", "infections…
#> $ time <time_prd> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1…
#> $ incidence.fit <dbl> 2.791372, 2.798220, 2.805334, 2.812709, 2.820342, 2.8…
#> $ incidence.se.fit <dbl> 0.05829053, 0.05436741, 0.05085982, 0.04774547, 0.045…
#> $ incidence.0.025 <dbl> 14.54322, 14.75618, 14.96404, 15.16711, 15.36573, 15.…
#> $ incidence.0.05 <dbl> 103.6897, 105.0781, 106.4406, 107.7792, 109.0962, 110…
#> $ incidence.0.25 <dbl> 109.7238, 110.7705, 111.8255, 112.8902, 113.9658, 115…
#> $ incidence.0.5 <dbl> 16.30338, 16.41541, 16.53259, 16.65497, 16.78259, 16.…
#> $ incidence.0.75 <dbl> 118.7000, 119.1997, 119.7670, 120.4004, 121.0987, 121…
#> $ incidence.0.95 <dbl> 125.6075, 125.6571, 125.8261, 126.1099, 126.5040, 127…
#> $ incidence.0.975 <dbl> 18.27657, 18.26120, 18.26556, 18.28879, 18.33010, 18.…
#> $ growth.fit <dbl> 0.006669413, 0.006901825, 0.007138772, 0.007379524, 0…
#> $ growth.se.fit <dbl> 0.005405515, 0.005196453, 0.004986659, 0.004776756, 0…
#> $ growth.0.025 <dbl> -3.925201e-03, -3.283037e-03, -2.634900e-03, -1.98274…
#> $ growth.0.05 <dbl> -0.0155530728, -0.0115190627, -0.0074448654, -0.00334…
#> $ growth.0.25 <dbl> 0.02116414, 0.02377809, 0.02642725, 0.02910356, 0.031…
#> $ growth.0.5 <dbl> 0.006669413, 0.006901825, 0.007138772, 0.007379524, 0…
#> $ growth.0.75 <dbl> 0.07220764, 0.07284746, 0.07351556, 0.07420978, 0.074…
#> $ growth.0.95 <dbl> 0.1089249, 0.1081446, 0.1073877, 0.1066561, 0.1059520…
#> $ growth.0.975 <dbl> 0.01726403, 0.01708669, 0.01691244, 0.01674179, 0.016…