Skip to contents

Takes a list of times, classes and counts, e.g. a COGUK variant like data set with time, (multinomial) class (e.g. variant) and count being the count in that time period. Fits a quadratic B-spline on time to the proportion of the data using nnet::multinom, with approx one degree of freedom per class and per window units of the time series

Usage

multinomial_nnet_model(
  d = i_multinomial_input,
  ...,
  window = 14,
  frequency = "1 day",
  predict = TRUE
)

Arguments

d

Multiclass count input

...

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

window

a number of data points between knots, smaller values result in less smoothing, large value in more.

frequency

the density of the output estimates.

predict

result a prediction. If false we return the model.

Value

a new dataframe with time (as a time period), class, and proportion.0.5, or a model object

Examples

if (FALSE) {
  # not run due to long running
  tmp = growthrates::england_covid %>%
    dplyr::filter(date > "2022-01-01") %>%
    growthrates::multinomial_nnet_model(window=21) %>%
    dplyr::glimpse()
}