`plot_prob_infection.Rd`

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
)
```

chain | A dataframe containing the MCMC samples |
---|---|

nsamps | Number of samples |

INCIDENCE_FUNC | A pointer to the Gaussian process model |

solve_times | Vector indicating the time over which the model is solved |

obs_dat | A dataframe containing observed Ct values and time of sample collection. NULL by default. |

true_prob_infection | A dataframe from simulated data with two columns, one for time and the other is the true probability of infection. NULL by default. |

tshift | Shift the solve times? Numeric, set to 0 by default |

smooth | 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

Other plots:
`plot_distribution_fits()`

,
`predicted_distribution_fits()`

James Hay, jhay@hsph.harvard.edu

```
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
```