From 7f4cfd4aadec484c6ef3bc7ecc457c6c9a56dd62 Mon Sep 17 00:00:00 2001 From: KeithJF82 Date: Wed, 12 Jun 2024 15:13:23 +0100 Subject: [PATCH] Update mcmc.R --- R/mcmc.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/mcmc.R b/R/mcmc.R index 15c8e21..9ac3499 100644 --- a/R/mcmc.R +++ b/R/mcmc.R @@ -126,6 +126,7 @@ MCMC <- function(log_params_ini=c(),input_data=list(),obs_sero_data=NULL,obs_cas #Calculate likelihood using single_posterior_calc function posterior_value_prop=single_posterior_calc(log_params_prop,input_data,obs_sero_data,obs_case_data,consts) + gc() if(is.finite(posterior_value_prop)==FALSE) { p_accept = -Inf @@ -578,6 +579,7 @@ mcmc_prelim_fit <- function(n_iterations=1,n_param_sets=1,n_bounds=1,type=NULL,l names(log_params_prop)=param_names posterior_value=single_posterior_calc(log_params_prop,input_data,obs_sero_data,obs_case_data,consts) + gc() results<-rbind(results,c(set,exp(log_params_prop),posterior_value)) if(set==1){colnames(results)=c("set",param_names,"posterior")}