R/generate_plots.R
plot_antibody_model.Rd
Plots example trajectories of the provided antibody kinetics model
plot_antibody_model(
antibody_model,
N = 100,
times = seq(1, 50, by = 1),
model_pars,
biomarker_map,
demography = NULL,
draw_parameters_fn = draw_parameters_fixed_fx,
...
)
A function determining the latent biomarker kinetics as a function of immune history and within-host kinetics parameters (model_pars
)
Number of trajectories to simulate
Vector of times to solve model over
A tibble of parameters needed for the antibody kinetics model, immunity model, observation model and the draw_parameters function
A tibble specifying the relationship between exposure IDs and biomarker IDs with two variables: 1) exposure_id: the numeric exposure ID; 2) biomarker_id: the numeric biomarker ID
A tibble of demographic information for each individual in the simulation. At a minimum this tibble requires 1 column (i) where all individuals in the simulation are listed by row. This is used to calculate the sample population size. Additional variables can be added by the user, e.g., birth and removal times, see generate_pop_demography
If not specified, the model will assume that birth time is the initial time point and removal time is the final time point across all individuals
Pointer to function used for drawing random kinetics parameters, see draw_parameters_fixed_fx
Any additional arguments needed for the models
A ggplot2 object
library(dplyr)
model_pars <- reformat_biomarker_map(example_model_pars_biphasic)%>% tidyr::drop_na()
draw_parameters_random_fx(1,1,1,NULL,NULL,model_pars)
#> # A tibble: 4 × 7
#> i t x b name value realized_value
#> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
#> 1 1 1 1 1 boost_long 0.476 0.476
#> 2 1 1 1 1 boost_short 0.364 0.364
#> 3 1 1 1 1 wane_long 0.0179 0.0179
#> 4 1 1 1 1 wane_short 0.0250 0.0250
biomarker_map <- dplyr::tibble(exposure_id=c(1,1,2),biomarker_id=c(1,2,1))
plot_antibody_model(antibody_model_biphasic, 50, model_pars=model_pars,
draw_parameters_fn = draw_parameters_random_fx, biomarker_map=biomarker_map)
plot_antibody_model(antibody_model_biphasic, 50, model_pars=model_pars,
draw_parameters_fn = draw_parameters_fixed_fx, biomarker_map=biomarker_map)