Simulate a process
simulate_process_for_testing.Rd
This function simulates a state-space process for testing purposes in a model with multiple delays and strata. It estimates the process over a specified number of steps, with options for trend degrees, priors, and error distributions.
Usage
simulate_process_for_testing(
num_steps = 10,
num_delays = 8,
num_strata = 2,
dist = c("NegativeBinomial", "Poisson"),
mu_degree = 1,
nu_degree = 1,
mu_is_constant = FALSE,
nu_is_constant = TRUE,
mu_sd_prior = "normal",
nu_sd_prior = "normal",
mu_sd_param_1 = 0,
mu_sd_param_2 = 0.1,
nu_sd_param_1 = 0,
nu_sd_param_2 = 0.1,
mu_0_mean_param_1 = log(100),
mu_0_mean_param_2 = 0.01,
mu_0_sd_param_1 = 0.01,
mu_0_sd_param_2 = 0.01,
nu_0_mean_param_1 = 0,
nu_0_mean_param_2 = 0.01,
nu_0_sd_param_1 = 0,
nu_0_sd_param_2 = 0.01,
mu_0_mean_hyperprior = "normal",
nu_0_mean_hyperprior = "normal",
mu_0_sd_hyperprior = "normal",
nu_0_sd_hyperprior = "normal",
r_prior = "normal",
r_param_1 = 0,
r_param_2 = 1
)
Arguments
- num_steps
Integer. Number of time steps to simulate. Default is 10.
- num_delays
Integer. Number of delay strata. Default is 8.
- num_strata
Integer. Number of strata for the population. Default is 2.
- dist
Distribution. Either "NegativeBinomial" or "Poisson"
- mu_degree
Integer. Degree of the epidemic trend. Default is 1.
- nu_degree
Integer. Degree of the delay trend. Default is 1.
- mu_is_constant
Logical. Indicates whether the epidemic trend is constant. Default is FALSE.
- nu_is_constant
Logical. Indicates whether the delay trend is constant. Default is TRUE.
- mu_sd_prior
Character. Prior for the epidemic trend error. Default is "normal".
- nu_sd_prior
Character. Prior for the delay trend error. Default is "normal".
- mu_sd_param_1
Numeric. First parameter for the epidemic trend error. Default is 0.0.
- mu_sd_param_2
Numeric. Second parameter for the epidemic trend error. Default is 1.0.
- nu_sd_param_1
Numeric. First parameter for the delay trend error. Default is 0.0.
- nu_sd_param_2
Numeric. Second parameter for the delay trend error. Default is 1.0.
- mu_0_mean_param_1
Character. Prior for the initial epidemic trend mean's first parameter.
- mu_0_mean_param_2
Character. Prior for the initial epidemic trend mean's second parameter.
- mu_0_sd_param_1
Character. Prior for the initial epidemic trend standard deviation's first parameter.
- mu_0_sd_param_2
Character. Prior for the initial epidemic trend standard deviation's second parameter.
- nu_0_mean_param_1
Character. Prior for the initial delay trend mean's first parameter.
- nu_0_mean_param_2
Character. Prior for the initial delay trend mean's second parameter.
- nu_0_sd_param_1
Character. Prior for the initial delay trend standard deviation's first parameter.
- nu_0_sd_param_2
Character. Prior for the initial delay trend standard deviation's second parameter.
- mu_0_mean_hyperprior
Prior distribution for the mean of the epidemic trend. Default is normal.
- nu_0_mean_hyperprior
Prior distribution for the mean of the delay trend. Default is normal.
- mu_0_sd_hyperprior
Prior distribution for the standard deviation of the epidemic trend. Default is normal (truncated).
- nu_0_sd_hyperprior
Prior distribution for the standard deviation of the delay trend. Default is normal (truncated).
- r_prior
Character. Prior for the negative binomial precision parameter. Default is "normal".
- r_param_1
Numeric. First parameter for the dispersion prior if negative binomial. Default is 0.0.
- r_param_2
Numeric. Second parameter for the dispersion prior if negative binomial. Default is 1.0.
Value
A tibble with simulated state-space process results, including the onset and report dates, strata, delays, and the number of observed cases per time step.
Examples
simulate_process_for_testing(num_steps = 20, num_delays = 5, num_strata = 3)
#> # A tibble: 300 × 6
#> .strata .delay .tval n onset_date report_date
#> <int> <int> <dbl> <dbl> <date> <date>
#> 1 1 1 1 56 2024-08-29 2024-08-29
#> 2 1 1 2 51 2024-08-30 2024-08-30
#> 3 1 1 3 113 2024-08-31 2024-08-31
#> 4 1 1 4 228 2024-09-01 2024-09-01
#> 5 1 1 5 51 2024-09-02 2024-09-02
#> 6 1 1 6 69 2024-09-03 2024-09-03
#> 7 1 1 7 354 2024-09-04 2024-09-04
#> 8 1 1 8 28 2024-09-05 2024-09-05
#> 9 1 1 9 131 2024-09-06 2024-09-06
#> 10 1 1 10 112 2024-09-07 2024-09-07
#> # ℹ 290 more rows