| fv_as_data_list | R Documentation |
Format data for use with stan
fv_as_data_list(
obs,
horizon = 4,
r_init = c(0, 0.25),
r_step = 1,
r_forecast = TRUE,
beta = c(0, 0.5),
lkj = 0.5,
voc_scale = c(0, 0.2),
period = NULL,
special_periods = c(),
variant_relationship = "correlated",
overdispersion = TRUE,
likelihood = TRUE,
output_loglik = TRUE,
debug = FALSE
)
obs |
A data frame with the following variables:
|
horizon |
Integer forecast horizon. Defaults to 4. |
r_init |
Numeric vector of length 2. Mean and standard deviation for the normal prior on the initial log growth rate. |
r_step |
Integer, defaults to 1. The number of observations between each change in the growth rate. |
r_forecast |
Logical, defaults |
beta |
Numeric vector, defaults to c(0, 0.5). Represents the mean and standard deviation of the normal prior (truncated at 1 and -1) on the weighting in the differenced AR process of the previous difference. Placing a tight prior around zero effectively reduces the AR process to a random walk on the growth rate. |
lkj |
Numeric defaults to 0.5. The assumed prior covariance between variants growth rates when using the "correlated" model. This sets the shape parameter for the Lewandowski-Kurowicka-Joe (LKJ) prior distribution. If set to 1 assigns a uniform prior for all correlations, values less than 1 indicate increased belief in strong correlations and values greater than 1 indicate increased belief weaker correlations. Our default setting places increased weight on some correlation between strains. |
voc_scale |
Numeric vector of length 2. Prior mean and standard deviation for the initial growth rate modifier due to the variant of concern. |
period |
Logical defaults to |
special_periods |
A vector of dates to pass to the |
variant_relationship |
Character string, defaulting to "correlated". Controls the relationship of strains with options being "correlated" (strains growth rates are correlated over time), "scaled" (a fixed scaling between strains), and "independent" (fully independent strains after initial scaling). |
overdispersion |
Logical, defaults to |
likelihood |
Logical, defaults to |
output_loglik |
Logical, defaults to |
debug |
Logical, defaults to |
A list as required by stan.
Functions used for modelling
fv_inits(),
fv_model(),
fv_sample()
fv_as_data_list(latest_obs(germany_covid19_delta_obs))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.