new_record = data.frame(Date = "2020-05-16", Symbol = "beta", Value = 0.1, Type = "abs")
But we need to add it in a very specific and non-intuitive way.
## so that simulation history works
tv_opt = rbind(pars_time_opt(sir_cal_tv), new_record)
sir_cal_tv2 = update_piece_wise(sir_cal_tv, tv_opt)
## so that simulate_ensemble works
tv_spec = rbind(pars_time_spec(sir_cal_tv$model_to_calibrate), new_record)
sir_cal_tv2$model_to_calibrate = update_piece_wise(sir_cal_tv2$model_to_calibrate, tv_spec)
Now we can do the simulations and view the different caused by the new record.
set.seed(1L)
ens = simulate_ensemble(sir_cal_tv)
set.seed(1L)
ens2 = simulate_ensemble(sir_cal_tv2)
sh = simulation_history(sir_cal_tv2)
all.equal(ens, ens2)
## should show the effect of the new record in model 2 only
bind_rows(ens, ens2, .id = "model") |>
filter(var == "I") |> ggplot() + geom_line(aes(Date, value, colour = model))
## should be similar, but to noise
plot(filter(ens2, var == "I")$value, sh$I)
abline(a = 0, b = 1)
Here is how to do it properly, but it really is confusing.
We use examples from the user guide.
Now that we are set up, we can add this record.
But we need to add it in a very specific and non-intuitive way.
Now we can do the simulations and view the different caused by the new record.