get_antibody_level_predictions: Generate antibody level credible intervals

View source: R/analysis.R

get_antibody_level_predictionsR Documentation

Generate antibody level credible intervals

Description

Generates credible intervals on antibody levels and infection histories from an MCMC chain output.

Usage

get_antibody_level_predictions(
  chain,
  infection_histories,
  antibody_data,
  demographics = NULL,
  individuals,
  antigenic_map = NULL,
  possible_exposure_times = NULL,
  par_tab,
  nsamp = 1000,
  add_residuals = FALSE,
  measurement_bias = NULL,
  for_res_plot = FALSE,
  expand_antibody_data = FALSE,
  expand_to_all_times = FALSE,
  antibody_level_before_infection = FALSE,
  for_regression = FALSE,
  data_type = 1,
  start_level = "none"
)

Arguments

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

antigenic_map

(optional) a data frame of antigenic x and y coordinates. Must have column names: x_coord; y_coord; inf_times. See example_antigenic_map

possible_exposure_times

(optional) if no antigenic map is specified, this argument gives the vector of times at which individuals can be infected

par_tab

the table controlling the parameters in the MCMC chain

nsamp

number of samples to take from posterior

add_residuals

if true, returns an extra output summarising residuals between the model prediction and data

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

for_res_plot

TRUE/FALSE value. If using the output of this for plotting of residuals, returns the actual data points rather than summary statistics

expand_antibody_data

TRUE/FALSE value. If TRUE, solves antibody level predictions for the entire study period (i.e., between the range of antibody_data$sample_time). 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.

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.

antibody_level_before_infection

TRUE/FALSE value. If TRUE, solves antibody level predictions, but gives the predicted antibody level at a given time point BEFORE any infection during that time occurs.

for_regression

if TRUE, returns posterior draws rather than posterior summaries

data_type

integer, currently accepting 1 or 2. Set to 1 for discretized, bounded data, or 2 for continuous, bounded data.

Value

a list with the antibody level predictions (95

Examples

## Not run: 
data(example_theta_chain)
data(example_inf_chain)
data(example_antibody_data)
data(example_antigenic_map)
data(example_par_tab)

y <- get_antibody_level_predictions(example_theta_chain, example_inf_chain, example_antibody_data,
                          unique(example_antibody_data$individual), example_antigenic_map,
                          example_par_tab,expand_antibody_data = FALSE)

## End(Not run)

seroanalytics/serosolver documentation built on July 11, 2024, 4:41 p.m.