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
)

Arguments

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 example_antigenic_map

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

Value

a data frame with columns samples, virus and titre of simulated data

See also

Examples

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)
#> Error in titre_data_fast(theta, inf_hist, strain_isolation_times, strain_indices, sampling_times, rows_per_indiv, cumu_rows, rows_per_blood, measured_strain_indices, antigenic_map_long, antigenic_map_short, antigenic_distances, mus, mu_indices): Not compatible with requested type: [type=NULL; target=double].