epiforecasts / EpiSoon

Forecasting the effective reproduction number over short timescales
https://epiforecasts.io/EpiSoon/
Other
7 stars 3 forks source link

Debug optim #29

Closed seabbs closed 4 years ago

seabbs commented 4 years ago
                 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)