Description Usage Arguments Examples
This function takes a model fit with fit_seir()
and converts the posterior
distribution into priors that can be fed into a second model. This allows
splitting a time series into multiple blocks.
1 | post2prior(obj, iter = seq_len(100), time_slice = max(proj$time))
|
obj |
A model fit with |
iter |
Iterations to use went creating projections to extract the state posterior. |
time_slice |
When to take the state priors at. Defaults to the end of the fit. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # See the vignette 'Fitting case data in multiple blocks'
# for a complete example
cases <- c(
0, 0, 1, 3, 1, 8, 0, 6, 5, 0, 7, 7, 18, 9, 22, 38, 53, 45, 40,
77, 76, 48, 67, 78, 42, 66, 67, 92, 16, 70, 43, 53, 55, 53, 29,
26, 37, 25, 45, 34, 40, 35
)
s1 <- c(rep(0.1, 13), rep(0.2, length(cases) - 13))
m <- fit_seir(
cases,
iter = 200,
fit_type = "optimizing",
samp_frac_fixed = s1
)
post2prior(m, iter = seq_len(10)) # just 10 for example speed
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.