View source: R/simulate_data.R
simulate_individual | R Documentation |
Simulates a full set of titre data for an individual with known theta and infection_history.
simulate_individual(
theta,
infection_history,
antigenic_map,
sampling_times,
strain_isolation_times,
measured_strains,
mus = NULL,
mu_indices = NULL,
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 |
strain_isolation_times |
(optional) If no antigenic map is specified, this argument gives the vector of times at which individuals can be infected |
measured_strains |
vector of which strains had titres measured in 'strain_isolation_times' |
mus |
default NULL, optional vector of boosting parameters for each strain |
mu_indices |
default NULL, optional vector giving the index of 'mus' that each strain uses the boosting parameter from. eg. if there are 6 circulation years in strain_isolation_times and 3 strain clusters, then this might be c(1,1,2,2,3,3) |
measurement_indices |
default NULL, optional vector giving the index of ‘measurement_bias' that each strain 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) |
add_noise |
if TRUE, adds observation noise to the simulated titres |
repeats |
number of repeat observations for each year |
a data frame with columns samples, virus and titre 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
strain_isolation_times <- example_antigenic_map$inf_times
y <- simulate_individual(pars, infection_history, example_antigenic_map, 2009,
strain_isolation_times,strain_isolation_times,add_noise=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.