View source: R/plot_antibody_model.R
plot_model_fits | R Documentation |
Given outputs from an MCMC run and the data used for fitting, generates an NxM matrix of plots where N is the number of individuals to be plotted and M is the range of sampling times. Where data are available, plots the observed antibody measurements and model predicted trajectories. Unlike plot_infection_histories_cross_sectional, places biomarker\_id on the x-axis and facets by sample time and individual.
plot_model_fits(
chain,
infection_histories,
antibody_data = NULL,
demographics = NULL,
individuals,
par_tab = NULL,
antigenic_map = NULL,
possible_exposure_times = NULL,
nsamp = 1000,
known_infection_history = NULL,
measurement_bias = NULL,
p_ncol = max(1, floor(length(individuals)/2)),
data_type = 1,
expand_to_all_times = FALSE,
orientation = "cross-sectional",
subset_biomarker_ids = NULL,
subset_biomarker_groups = NULL,
start_level = "none",
settings = NULL
)
chain |
the full MCMC chain to generate antibody level trajectories from |
infection_histories |
the MCMC chain for infection histories |
antibody_data |
the data frame of antibody level data |
individuals |
the subset of individuals to generate credible intervals for |
par_tab |
the table controlling the parameters in the MCMC chain |
antigenic_map |
(optional) a data frame of antigenic x and y coordinates. Must have column names: x_coord; y_coord; inf_times. See |
possible_exposure_times |
(optional) if no antigenic map is specified, this argument gives the vector of times at which individuals can be infected |
nsamp |
number of samples to take from posterior |
known_infection_history |
nxm matrix of known infection histories |
measurement_bias |
default NULL, optional data frame giving the index of ‘rho' that each biomarker_id and biomarker_group which uses the measurement shift from from. eg. if there’s 6 circulation years and 3 strain clusters |
p_ncol |
integer giving the number of columns of subplots to create if using orientation = "longitudinal" |
data_type |
integer, currently accepting 1 or 2. Set to 1 for discretized, bounded data, or 2 for continuous, bounded data. |
expand_to_all_times |
TRUE/FALSE value. If TRUE, solves antibody level predictions for all possible infection times (i.e., for the range in possible_exposure_times). If left FALSE, then only solves for the infections times at which a antibody level against the circulating biomarker_id was measured in antibody_data. |
orientation |
either "cross-sectional" or "longitudinal" |
subset_biomarker_ids |
if not NULL, then a vector giving the entries of biomarker_id to include in the longitudinal plot |
settings |
if not NULL, list of serosolver settings as returned from the main serosolver function |
a ggplot2 object
Other infection_history_plots:
calculate_infection_history_statistics()
,
plot_antibody_data()
,
plot_antibody_predictions()
,
plot_cumulative_infection_histories()
,
plot_estimated_antibody_model()
,
plot_individual_number_infections()
,
plot_infection_history_chains_indiv()
,
plot_infection_history_chains_time()
,
plot_posteriors_infhist()
,
plot_total_number_infections()
## Not run:
data(example_theta_chain)
data(example_inf_chain)
data(example_antibody_data)
data(example_antigenic_map)
data(example_par_tab)
model_fit_plot <- plot_model_fits(example_theta_chain, example_inf_chain, example_antibody_data,
1:10, example_antigenic_map, example_par_tab,orientation="longitudinal")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.