Optimised compare_timeseries to work across regions and models.
Added parallel support for compare_models
Doc changes to pass CRAN check
Hooked up Travis
Run a model sweep (see below for settings) with 10 samples that worked as expected using the latest data from Covid. Currently running a 1000 sample sweep to check.
Identified a warning from rpois that needs chasing up but is not obviously impacting behaviour. Opened as an issue.
function(ss, y){bsts::AddAr(ss, y = y, lags = 3)},
"AR2" =
function(ss, y){bsts::AddAr(ss, y = y, lags = 2)},
"AR1" =
function(ss, y){bsts::AddAr(ss, y = y, lags = 1)},
"Sparse AR" =
function(ss, y){
if (length(y) < 10) {
bsts::AddAr(ss, y = y, lags = 3)
} else{
bsts::AddAutoAr(ss, y = y, lags = 7)
}},
"Forgetful AR3" =
function(ss, y){bsts::AddAr(ss, y = y[min(length(y)-14,1):length(y)], lags = 3)},
"Local linear trend" =
function(ss, y){bsts::AddLocalLinearTrend(ss, y = y)},
"Semi-local linear trend" =
function(ss, y){bsts::AddSemilocalLinearTrend(ss, y = y)},
"Very local linear trend" =
function(ss, y){bsts::AddSemilocalLinearTrend(ss, y = y[min(length(y)-14,1):length(y)])})
future::plan("multiprocess")
res <- EpiSoon::compare_timeseries(obs_rts = obs_rts, obs_cases = obs_cases,
horizon = 21, samples = 1000,
serial_interval = si_samp,
models = models)
compare_timeseries
to work across regions and models.compare_models