diff --git a/R/main.R b/R/main.R index ad273e8..a7dc333 100644 --- a/R/main.R +++ b/R/main.R @@ -325,8 +325,8 @@ Model_Run_Many_Reps <- function(FOI_spillover = 0.0, R0 = 1.0, vacc_data = list( parameter_setup <- function(FOI_spillover = 0.0, R0 = 1.0, vacc_data = list(), pop_data = list(), year0 = 1940, years_data = c(1941:1942), mode_start = 0, vaccine_efficacy = 1.0, start_SEIRV = list(), dt = 1.0){ - assert_that(FOI_spillover>0.0) - assert_that(R0>0.0) + assert_that(FOI_spillover>=0.0) + assert_that(R0>=0.0) assert_that(length(pop_data[, 1])>1, msg = "Need population data for multiple years") assert_that(length(pop_data[1, ])>1, msg = "Need population data for multiple age groups") n_years = length(pop_data[, 1])-1 diff --git a/src/YEP.dll b/src/YEP.dll index 3cc8cc0..441d06d 100644 Binary files a/src/YEP.dll and b/src/YEP.dll differ diff --git a/src/cpp11.o b/src/cpp11.o index c25b5cb..5a88897 100644 Binary files a/src/cpp11.o and b/src/cpp11.o differ diff --git a/vignettes/BWorkedExampleDMCMC.Rmd b/vignettes/BWorkedExampleDMCMC.Rmd index dca91fc..cecd689 100644 --- a/vignettes/BWorkedExampleDMCMC.Rmd +++ b/vignettes/BWorkedExampleDMCMC.Rmd @@ -56,9 +56,6 @@ log_params_ini <- c(log(enviro_coeffs_ini), log(c(0.1,0.2))) filename_prefix <- "Chain" #Number of iterations to run Niter <- 1 -# Type of parameter set used to calculate spillover FOI and R0 (here both -# calculated from environmental covariates) -type <- "FOI+R0 enviro" # Flag indicating how to set initial population immunity level mode_start <- 1 # Type of prior likelihood calculation to use @@ -71,26 +68,23 @@ n_reps <- 5 p_severe_inf = 0.12 # Probability of an infection with severe symptoms causing death p_death_severe_inf = 0.39 -# Fixed R0 values (here set to NULL because R0 is variable) -R0_fixed_values = NULL # Additional values: severe and fatal case reporting probability are set to NULL due to being estimated # as variables; vaccine efficacy and Brazil spillover FOI multiplier set to 1.0 as constants. -add_values=list(p_rep_severe = NULL, p_rep_death = NULL, vaccine_efficacy = 1.0, m_FOI_Brazil = 1.0) +add_values=list(p_rep_severe = NA, p_rep_death = NA, vaccine_efficacy = 1.0, m_FOI_Brazil = 1.0) # True/false flag indicating whether or not to run model in deterministic mode # (so that binomial calculations give average instead of randomized output) deterministic = FALSE # Variable to set different modes for running on multiple processors simultaneously; # here set to "none" so that parallel processing is not used -mode_parallel="none" +mode_parallel=FALSE ``` We then run the MCMC() function. Output data recorded at each iteration is saved to an output file every 10 iterations. Likelihood is calculated as described in Guide 4 [Link TBA]. ```{r,eval=FALSE} MCMC(log_params_ini, input_data, obs_sero_data, obs_case_data, filename_prefix, - Niter, type, mode_start, prior_settings, dt, - n_reps, enviro_data, R0_fixed_values, p_severe_inf, p_death_severe_inf, - add_values, deterministic,mode_parallel,NULL) + Niter, mode_start, prior_settings, dt, n_reps, enviro_data, p_severe_inf, + p_death_severe_inf, add_values, deterministic,mode_parallel,NULL) ``` The saved output of MCMC() takes the form of a data frame of values of the current likelihood (posterior_current), likelihood calculated from proposed parameter values (posterior_prop), current and proposed parameter values, a flag indicating whether the proposed parameter values were accepted (set to 1 if they were accepted, 0 if they were not), and the chain covariance.