create_model_group_func_cpp: Create model function pointer cpp implementation

Description Usage Arguments Value

View source: R/model_creation.R

Description

Creaters a function pointer for model_func_group_cpp to save passing multiple vectors constantly. This function will return the same thing, but requires only a vector of (unnamed) parameters and a vector of times providing the parameter vector is the same order as in the given parTab argument. This function can also be used to create a pointer to the same model function, but solving a likelihood function and returning a single likelihood given data and a set of model parameters.

Usage

1
2
3
4
5
6
7
create_model_group_func_cpp(parTab, exposureTab, dat = NULL,
  PRIOR_FUNC = NULL, version = "model", convert_types = c(all = 0,
  infection = 1, vacc = 2, adj = 3, mod = 4, `NA` = 5),
  convert_strains = c(A = 1, B = 2, C = 3, D = 4, E = 5),
  convert_groups = c(`1` = 1, `2` = 2, `3` = 3, `4` = 4, `5` = 5),
  individuals = c(1, 1, 1, 1, 1), form = "isolated", typing = FALSE,
  cross_reactivity = FALSE)

Arguments

parTab

the full parameter table - see example csv file

exposureTab

table of exposure times etcs - see example csv file

dat

can be left as NULL if just solving the model and not the likelihood. If solving the posterior function, need the matrix of data. First row is model times, and subsequent rows are trajectories (each row is trajectory of antibodies for one strain, grouped by exposure group)

PRIOR_FUNC

optional pointer to prior calculating function that takes current parameter vector

version

string of either "model" (for pure model function) or "posterior" (for posterior calculation)

convert_types

optionally, a named vector converting strings of infection types to integers. The Cpp function needs these as integers rather than characters/strings, but the default arguments here should be fine

convert_strains

as for convert_types, but relating to the infection strain names

convert_groups

if the groups are named, used to convert names to integers

individuals

vector indicating how many individuals are in each group ie. relating to rows in the data matrix. This is used to index the data matrix eg. if the first argument of the individuals vector is 3, then the first 3 rows of data will be assumed to correspond to the same group/strain

form

string of "isolated" or "competitive" indicating whether we're using the isolation boosting or competitive boosting version of the model

cross_reactivity

if TRUE, uses cross reactivity parameters to infer expected titres against heterologous strains

trying

if TRUE, uses parameters corresponding to the exposure type rather than exposure index

Value

a function pointer for model_func_group_cpp or posterior_func_group_cpp


jameshay218/antibodyKinetics documentation built on Nov. 8, 2019, 11 a.m.