Plot probabilities of infection from compartmental model. Returns the probabilities and the plot.
plot_prob_infection( chain, nsamps, INCIDENCE_FUNC, solve_times, obs_dat = NULL, true_prob_infection = NULL, tshift = 0, smooth = FALSE )
A dataframe containing the MCMC samples
Number of samples
A pointer to the Gaussian process model
Vector indicating the time over which the model is solved
A dataframe containing observed Ct values and time of sample collection. NULL by default.
A dataframe from simulated data with two columns, one for time and the other is the true probability of infection. NULL by default.
Shift the solve times? Numeric, set to 0 by default
Smooth the model estimates for plotting? FALSE by default.
Return a list containing three things: 1. A dataframe of model predictions containing time, probability of infection, and sample number; 2. A dataframe containing the maximum posterior probability of infection and time; 3. A ggplot showing the probabilities of infection
James Hay, email@example.com
data(example_seir_incidence) predictions <- plot_prob_infection(chain_comb, nsamps=100, INCIDENCE_FUNC=incidence_function, solve_times=0:max(ct_data_use$t), obs_dat=ct_data_use, true_prob_infection=example_seir_incidence) #> Error in unique(chain$sampno) object 'chain_comb' not found p_incidence_prediction <- predictions$plot + scale_x_continuous(limits=c(0,200)) #> Error in eval(expr, envir, enclos) object 'predictions' not found p_incidence_prediction #> Error in eval(expr, envir, enclos) object 'p_incidence_prediction' not found