Attach a data set to a flexmodel object. Any existing data will be removed.

update_observed(model, data, loss_params = NULL, regenerate_rates = TRUE)

Arguments

model

flexmodel object

data

observed data frame in long format to compare with simulated trajectories. must have the following columns: date, var, value.

loss_params

TODO

regenerate_rates

should rates be regenerated to sort out any index misalignment that may be introduced by editing the model?

Value

a flexmodel object with an observed element, which is a list with two elements: (1) data (the attached data) and (2) loss (a data frame describing the additional parameters that are required to fit the model to data -- these parameters are added to the params of the model)