individual_simulation: Individual serology simulation

Description Usage Arguments Value See Also Examples

View source: R/model.R

Description

Simulates a data frame of serology measurements using the given data generating function.

Usage

1
2
3
individual_simulation(infection_times, y0s, processParams, times,
  strain_names = c("a", "b", "c"), sample_times,
  PROCESS_FUNCTION = multiple_strains)

Arguments

infection_times

a vector of infection times for each strain (index should match strain names order)

processParams

a generic vector of parameters to be passed to the data generating function.

times

a vector of times to return values from the simulation

strain_names

a vector of strain names for data labels

PROCESS_FUNCTION

pointer to a function to calculate the data at the given time points. The function should take the following arguments: "infection_times" - a vector of times of infection with each strain; "y0" - a vector of initial values for each strain; processParams - as above; t - vector of times. This function should return a matrix of serological values matching the simulation data type. The first column should be time in days, and each subsequent column should be the measurement for each strain of interest on that day. See multiple_strains for an example (and default).

y0

vector of baseline values. eg. if three pathogens are being tested, this should be a vector of three values.

Value

a data frame with time series readings for each of the given strains

See Also

overall_simulation

Examples

1
2
3
4
5
6
7
8
9
infection_times <- c(0,50,100)
y0 <- c(0,0,0)

times <- seq(0,200,by=1)
strains <- c("A","B","C")

dat <- individual_simulation(infection_times, y0, processParams, times, strains, multiple_strains)
Go through each infection and generate a trajectory
Create column names and only return desired sample times

jameshay218/serosim2 documentation built on May 18, 2019, 11:21 a.m.