This function, that can be wrapped within nosoiSim, runs a single-host transmission chain simulation, without any structure features in the host population. 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.

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

Arguments

length.sim

specifies the length (in unit of time) over which the simulation should be run.

max.infected

specifies the maximum number of hosts that can be infected in the simulation.

init.individuals

number of initially infected individuals.

pExit

function that gives the probability to exit the simulation for an infected host (either moving out, dying, etc.).

param.pExit

parameter names (list of functions) for the pExit.

timeDep.pExit

is pExit dependent on the absolute time of the simulation? (TRUE/FALSE)

nContact

function that gives the number of potential transmission events per unit of time.

param.nContact

parameter names (list of functions) for param.nContact.

timeDep.nContact

is nContact dependent on the absolute time of the simulation? (TRUE/FALSE)

pTrans

function that gives the probability of transmit a pathogen as a function of time since infection.

param.pTrans

parameter names (list of functions) for the pExit.

timeDep.pTrans

is pTrans dependent on the absolute time of the simulation? (TRUE/FALSE)

prefix.host

character(s) to be used as a prefix for the hosts identification number.

print.progress

if TRUE, displays a progress bar (current time/length.sim).

print.step

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").

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.

See also

For simulations with a discrete structured host population, see singleDiscrete. For simulations with a structured population in continuous space, singleContinuous

Examples

# \donttest{ t_incub_fct <- function(x){rnorm(x,mean = 5,sd=1)} p_max_fct <- function(x){rbeta(x,shape1 = 5,shape2=2)} p_Exit_fct <- function(t){return(0.08)} proba <- function(t,p_max,t_incub){ if(t <= t_incub){p=0} if(t >= t_incub){p=p_max} return(p) } time_contact <- function(t){round(rnorm(1, 3, 1), 0)} test.nosoi <- nosoiSim(type="single", popStructure="none", length=40, max.infected=100, init.individuals=1, nContact=time_contact, param.nContact=NA, pTrans = proba, param.pTrans = list(p_max=p_max_fct, t_incub=t_incub_fct), pExit=p_Exit_fct, param.pExit=NA)
#> Starting the simulation #> Initializing ...
#> running ...
#> done. #> The simulation has run for 2 units of time and a total of 1 hosts have been infected.
test.nosoi
#> A nosoiSim object, representing a simulated epidemy for a single host with no structure. #> The simulation has run for 2 units of time and a total of 1 hosts have been infected. #> Use function 'summary' for summary statistics, and functions 'getTableHosts' and 'getTableState' to extract the generated data.
# }