nosoi (version 1.0.0)

singleNone: Single-host pathogen in a homogeneous host population

Description

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.

Usage

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)

Value

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

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.

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

See Also

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

Examples

Run this code
# NOT RUN {
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)

test.nosoi
# }

Run the code above in your browser using DataLab