Compare observed and modelled data from the basic model. This conforms to the mcstate interface.

basic_compare(state, prev_state, observed, pars)

Arguments

state

State vector for the end of the current day. This is assumed to be filtered following basic_index() so contains rows corresponding to ICU and deaths.

prev_state

State vector for the end of the previous day, as for state.

observed

Observed data. This will be a list with elements icu (number of ICU beds occupied) and deaths (number of deaths over this day).

pars

A list of parameters, as created by basic_parameters()

Value

A vector of log likelihoods, the same length as the number of particles (the number of columns in the modelled state)

Examples

state <- rbind(icu = 10:15, deaths = 1:6) prev_state <- matrix(1, 2, 6, dimnames = dimnames(state)) observed <- list(icu = 13, deaths = 3) pars <- basic_parameters(sircovid_date("2020-02-07"), "england") basic_compare(state, prev_state, observed, pars)
#> [1] -47.303412 -6.147741 -5.399510 -5.237661 -5.252074 -5.336899
basic_compare(state * 5, prev_state, observed, pars)
#> [1] -6.315318 -6.974462 -7.622200 -8.171863 -8.644335 -9.058637