Generates an incidence curve (probability of infection per unit time) and associated parameters from a Gaussian Process model assuming that the covariance function (kernel) on time follows the squared exponential covariance function. It is recommended to use the outputs of simulate_gaussian_process
as inputs to this function.
exposure_model_gaussian_process(i, t, x, g, foe_pars, demography, ...)
individual
time
exposure
group
Data frame giving named parameters of the Gaussian process model for each unique group and exposure ID. Mandatory variable names are: 1) value (parameter value); 2) name (parameter name); 3) x (exposure ID); 4) g (group ID). Each group/exposure combination must have entries for the following parameters: l, sigma, scale_factor, tmax, eta. Note that eta gives the means of the Gaussian process at each time point, and thus there must be one entry for every element of seq(0,tmax,by=1).
A tibble of relevant demographic information for each individual in the simulation.
Additional arguments
Returns incidence for given time points t.
pars_x1 <- c("sigma"=1,"l"=100,"scale_factor"=1, "tmax"=365*5)
pars_x2 <- c("sigma"=2,"l"=100,"scale_factor"=0.25, "tmax"=365*5)
tmp_x1 <- simulate_gaussian_process(pars_x1)
tmp_x2 <- simulate_gaussian_process(pars_x2)
foe_pars1 <- data.frame(name=names(tmp_x1$pars), value=unname(tmp_x1$pars),x=1,g=1)
foe_pars2 <- data.frame(name=names(tmp_x2$pars), value=unname(tmp_x2$pars),x=2,g=1)
foe_pars <- dplyr::bind_rows(foe_pars1, foe_pars2)
exposure_model_gaussian_process(1, 365, 1, 1, foe_pars, NULL)
#> [1] 0.0004959706