View source: R/simulate_data.R
simulate_individual | R Documentation |
Simulates a full set of antibody data for an individual with known theta and infection_history.
simulate_individual(
theta,
infection_history,
antigenic_map,
sampling_times,
possible_exposure_times,
measured_biomarker_ids,
measurement_bias = NULL,
measurement_indices = NULL,
add_noise = TRUE,
repeats = 1,
DOB = NULL
)
theta |
the named parameter vector |
infection_history |
the vector of 1s and 0s giving presence/absence of infections |
antigenic_map |
(optional) A data frame of antigenic x and y coordinates. Must have column names: x_coord; y_coord; inf_times. See |
sampling_times |
vector of times at which blood samples were taken |
possible_exposure_times |
(optional) If no antigenic map is specified, this argument gives the vector of times at which individuals can be infected |
measured_biomarker_ids |
vector of which biomarker IDs had measurements in 'possible_exposure_times' |
measurement_indices |
default NULL, optional vector giving the index of ‘measurement_bias' that each antigen/biomarker ID uses the measurement shift from from. eg. if there’s 6 circulation years and 3 strain clusters, then this might be c(1,1,2,2,3,3) |
repeats |
number of repeat observations for each year |
a data frame with columns samples, biomarker IDs and antibody levels of simulated data
Other simulation_functions:
simulate_attack_rates()
,
simulate_data()
,
simulate_group()
,
simulate_individual_faster()
,
simulate_infection_histories()
data(example_par_tab)
data(example_antigenic_map)
infection_history <- sample(c(0,1),size=nrow(example_antigenic_map), replace=TRUE,prob=c(0.9,0.1))
pars <- example_par_tab$values
names(pars) <- example_par_tab$names
possible_exposure_times <- example_antigenic_map$inf_times
y <- simulate_individual(pars, infection_history, example_antigenic_map, 2009,
possible_exposure_times,possible_exposure_times,add_noise=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.