This function, that can be wrapped within nosoiSim, runs a dual-host transmission chain simulation, without any structure features in both hosts populations. The simulation stops either at the end of given time (specified by length.sim) or when the number of hosts infected threshold (max.infected) is crossed.

dualNone(
length.sim,
max.infected.A,
max.infected.B,
init.individuals.A,
init.individuals.B,
pExit.A,
param.pExit.A,
timeDep.pExit.A = FALSE,
nContact.A,
param.nContact.A,
timeDep.nContact.A = FALSE,
pTrans.A,
param.pTrans.A,
timeDep.pTrans.A = FALSE,
prefix.host.A = "H",
pExit.B,
param.pExit.B,
timeDep.pExit.B = FALSE,
nContact.B,
param.nContact.B,
timeDep.nContact.B = FALSE,
pTrans.B,
param.pTrans.B,
timeDep.pTrans.B = FALSE,
prefix.host.B = "V",
print.progress = TRUE,
print.step = 10
)

Arguments

length.sim specifies the length (in unit of time) over which the simulation should be run. specifies the maximum number of individual hosts A that can be infected in the simulation. specifies the maximum number of individual hosts B that can be infected in the simulation. number of initially infected individuals (hosts A). number of initially infected individuals (hosts B). function that gives the probability to exit the simulation for an infected host A (either moving out, dying, etc.). parameter names (list of functions) for the pExit for host-type A. is pExit of host-type A dependent on the absolute time of the simulation (TRUE/FALSE)? function that gives the number of potential transmission events per unit of time for host-type A. parameter names (list of functions) for param.nContact for host-type A. is nContact of host-type A dependent on the absolute time of the simulation (TRUE/FALSE)? function that gives the probability of transmit a pathogen as a function of time since infection for host A. parameter names (list of functions) for the pExit for host A. is pTrans of host-type A dependent on the absolute time of the simulation (TRUE/FALSE)? character(s) to be used as a prefix for the host A identification number. function that gives the probability to exit the simulation for an infected host B (either moving out, dying, etc.). parameter names (list of functions) for the pExit for host-type B. is pExit of host-type B dependent on the absolute time of the simulation (TRUE/FALSE)? function that gives the number of potential transmission events per unit of time for host B. parameter names (list of functions) for param.nContact for host-type B. is nContact of host-type B dependent on the absolute time of the simulation (TRUE/FALSE)? function that gives the probability of transmit a pathogen as a function of time since infection for host B. parameter names (list of functions) for the pExit for host-type B. is pTrans of host-type B dependent on the absolute time of the simulation (TRUE/FALSE)? character(s) to be used as a prefix for the host B identification number. if TRUE, displays a progress bar (current time/length.sim). print.progress is TRUE, step with which the progress message will be printed.

Value

An object of class nosoiSim, containing all results of the simulation.

Details

The pExit and pTrans functions should return a single probability (a number between 0 and 1), and nContact a positive natural number (positive integer) or 0.

The param arguments should be a list of functions or NA. Each item name in the parameter list should have the same name as the argument in the corresponding function.

The use of timeDep (switch to TRUE) makes the corresponding function use the argument prestime (for "present time").

Suffixes

The suffix .A or .B specifies if the considered function or parameter concerns host type A or B.

Order of Arguments

The user specified function's arguments should follow this order: t (mandatory), prestime (optional, only if timeDep is TRUE), parameters specified in the list.

For simulations with a discrete structured host population, see dualDiscrete. For simulations with a structured population in continuous space, dualContinuous

Examples

# \donttest{
#Host A
t_infectA_fct <- function(x){rnorm(x,mean = 12,sd=3)}
pTrans_hostA <- function(t,t_infectA){
if(t/t_infectA <= 1){p=sin(pi*t/t_infectA)}
if(t/t_infectA > 1){p=0}
return(p)
}

p_Exit_fctA  <- function(t,t_infectA){
if(t/t_infectA <= 1){p=0}
if(t/t_infectA > 1){p=1}
return(p)
}

time_contact_A = function(t){sample(c(0,1,2),1,prob=c(0.2,0.4,0.4))}

#Host B
t_incub_fct_B <- function(x){rnorm(x,mean = 5,sd=1)}
p_max_fct_B <- function(x){rbeta(x,shape1 = 5,shape2=2)}

p_Exit_fct_B  <- function(t,prestime){(sin(prestime/12)+1)/5}

pTrans_hostB <- function(t,p_max,t_incub){
if(t <= t_incub){p=0}
if(t >= t_incub){p=p_max}
return(p)
}

time_contact_B = function(t){round(rnorm(1, 3, 1), 0)}

set.seed(90)
test.nosoi <- nosoiSim(type="dual", popStructure="none",
length.sim=40,
max.infected.A=100,
max.infected.B=200,
init.individuals.A=1,
init.individuals.B=0,
pExit.A = p_Exit_fctA,
param.pExit.A = list(t_infectA = t_infectA_fct),
timeDep.pExit.A=FALSE,
nContact.A = time_contact_A,
param.nContact.A = NA,
timeDep.nContact.A=FALSE,
pTrans.A = pTrans_hostA,
param.pTrans.A = list(t_infectA=t_infectA_fct),
timeDep.pTrans.A=FALSE,
prefix.host.A="H",
pExit.B = p_Exit_fct_B,
param.pExit.B = NA,
timeDep.pExit.B=TRUE,
nContact.B = time_contact_B,
param.nContact.B = NA,
timeDep.nContact.B=FALSE,
pTrans.B = pTrans_hostB,
param.pTrans.B = list(p_max=p_max_fct_B,
t_incub=t_incub_fct_B),
timeDep.pTrans.B=FALSE,
prefix.host.B="V")#> Starting the simulation
#> Initializing ...#>  running ...#> Time: 10 (25% of maximum length). Hosts count: (A) 1 (1% of maximum infected hosts); (B) 11 (6% of maximum infected hosts).#> Time: 20 (50% of maximum length). Hosts count: (A) 4 (4% of maximum infected hosts); (B) 32 (16% of maximum infected hosts).#> Time: 30 (75% of maximum length). Hosts count: (A) 12 (12% of maximum infected hosts); (B) 68 (34% of maximum infected hosts).#> done.
#> The simulation has run for 39 units of time and a total of 71 (A) and 221 (B) hosts have been infected.
test.nosoi#> A nosoiSim object, representing a simulated epidemy for a dual host with no structure.
#> The simulation has run for 39 units of time and a total of 71 (A) and 71 (B) hosts have been infected.
#> Use function 'summary' for summary statistics, and functions 'getTableHosts' and 'getTableState' to extract the generated data.# }