Takes the output of stan_opts()
and converts it into a list understood by
stan. Internally calls the other create_
family of functions to
construct a single list for input into stan with all data required
present.
Arguments
- data
A
<data.frame>
of confirmed cases (confirm) by date (date).confirm
must be numeric anddate
must be in date format.- seeding_time
Integer; seeding time, usually obtained using
get_seeding_time()
.- rt
A list of options as generated by
rt_opts()
defining Rt estimation. Defaults tort_opts()
. Set toNULL
to switch to using back calculation rather than generating infections using Rt.- gp
A list of options as generated by
gp_opts()
to define the Gaussian process. Defaults togp_opts()
. Set toNULL
to disable the Gaussian process.- obs
A list of options as generated by
obs_opts()
defining the observation model. Defaults toobs_opts()
.- horizon
Numeric, defaults to 7. Number of days into the future to forecast.
- backcalc
A list of options as generated by
backcalc_opts()
to define the back calculation. Defaults tobackcalc_opts()
.- shifted_cases
A
<data.frame>
of delay shifted cases
Examples
create_stan_data(
example_confirmed, 7, rt_opts(), gp_opts(), obs_opts(), 7,
backcalc_opts(), create_shifted_cases(example_confirmed, 7, 14, 7)
)
#> $cases
#> [1] 238 240 561 347 466 587 769 778 1247 1492 1797 977 2313 2651 2547
#> [16] 3497 2823 4000 3526 4207 5322 5986 6557 5560 4789 5249 5210 6153 5959 5974
#> [31] 5217 4050 4053 4782 4668 4585 4805 4316 3599 3039 3836 4204 3951 4694 4092
#> [46] 3153 2972 2667 3786 3493 3491 3047 2256 2729 3370 2646 3021 2357 2324 1739
#> [61] 2091 2086 1872 1965 1900 1389 1221 1075 1444 1401 1327 1083 802 744 1402
#> [76] 888 992 789 875 675 451 813 665 642 652 669 531 300 397 584
#> [91] 593 516 416 355 178 318 321 177 518 270 197 280 283 202 379
#> [106] 163 346 338 301 210 328 331 0 264 224 221
#>
#> $cases_time
#> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#> [19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#> [37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#> [55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#> [73] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
#> [91] 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
#> [109] 109 110 111 112 113 114 115 116
#>
#> $lt
#> [1] 116
#>
#> $shifted_cases
#> date confirm
#> <Date> <num>
#> 1: 2020-03-07 3028
#> 2: 2020-03-08 3407
#> 3: 2020-03-09 3698
#> 4: 2020-03-10 3912
#> 5: 2020-03-11 4217
#> ---
#> 112: 2020-06-26 157
#> 113: 2020-06-27 152
#> 114: 2020-06-28 146
#> 115: 2020-06-29 141
#> 116: 2020-06-30 136
#>
#> $t
#> [1] 130
#>
#> $horizon
#> [1] 7
#>
#> $burn_in
#> [1] 0
#>
#> $seeding_time
#> [1] 7
#>
#> $r_mean
#> [1] 1
#>
#> $r_sd
#> [1] 1
#>
#> $estimate_r
#> [1] 1
#>
#> $bp_n
#> [1] 0
#>
#> $breakpoints
#> NULL
#>
#> $future_fixed
#> [1] 1
#>
#> $fixed_from
#> [1] 0
#>
#> $pop
#> [1] 0
#>
#> $stationary
#> [1] 0
#>
#> $future_time
#> [1] 7
#>
#> $prior_infections
#> [1] 6.127493
#>
#> $prior_growth
#> [1] 0
#>
#> $rt_half_window
#> [1] 0
#>
#> $backcalc_prior
#> [1] 1
#>
#> $fixed
#> [1] 0
#>
#> $M
#> [1] 24
#>
#> $L
#> [1] 1.5
#>
#> $ls_meanlog
#> [1] 2.991842
#>
#> $ls_sdlog
#> [1] 0.3245928
#>
#> $ls_min
#> [1] 0
#>
#> $ls_max
#> [1] 116
#>
#> $alpha_sd
#> [1] 0.05
#>
#> $gp_type
#> [1] 0
#>
#> $model_type
#> [1] 1
#>
#> $phi_mean
#> [1] 0
#>
#> $phi_sd
#> [1] 1
#>
#> $week_effect
#> [1] 7
#>
#> $obs_weight
#> [1] 1
#>
#> $obs_scale
#> [1] 0
#>
#> $obs_scale_mean
#> [1] 1
#>
#> $obs_scale_sd
#> [1] 0
#>
#> $accumulate
#> [1] 0
#>
#> $likelihood
#> [1] 1
#>
#> $return_likelihood
#> [1] 0
#>
#> $day_of_week
#> [1] 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7
#> [38] 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2
#> [75] 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4
#> [112] 5 6 7 1 2 3 4 5 6 7 1 2
#>