nosoiSim: Top-level function to use 'nosoi'.

View source: R/nosoiSim.R

nosoiSimR Documentation

Top-level function to use nosoi.

Description

This function determines which general settings the user wants to use for his simulation. All other arguments are passed down to the chosen simulator itself, such as singleNone, singleDiscrete, singleContinuous, dualNone, dualDiscrete or dualContinuous.

Usage

nosoiSim(type = "single", popStructure = "none", ...)

Arguments

type

specifies which type of pathogen we are interested in, either "single" or "dual"-host (e.g. arboviruses).

popStructure

specifies if the population in which the transmission is to occur is structured ("none", "discrete" or "continuous").

...

arguments to be passed on to the chosen simulator itself, such as singleNone, singleDiscrete, singleContinuous, dualNone, dualDiscrete or dualContinuous.

Value

An object of class nosoiSim, containing all results of the simulation. Class nosoiSim object have the following slots:

total.time

Number of time steps the simulation ran (integer).

type

String giving the simulation type ("single" or "dual" host).

host.info.A: object of class nosoiSimOne
N.infected

Number of infected hosts (integer).

table.hosts

Table containing the results of the simulation (see getTableHosts for more details on the table).

table.state

Table containing the results of the simulation, focusing on the movement history of each host (see getTableState for more details on the table).

prefix.host

String containing the prefix used to name hosts (character string).

popStructure

String giving the population structure (one of "none", "discrete" or "continuous").

host.info.B: object of class nosoiSimOne

Same structure as host.info.A, but for host B (if it exists).

See Also

Individual simulation functions:

singleNone, singleDiscrete, singleContinuous, dualNone, dualDiscrete and dualContinuous.

Functions to extract the results:

getTableHosts, getTableState

Summary statistics functions:

nosoiSummary, getCumulative, getDynamic, getR0

Examples


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



nosoi documentation built on May 29, 2024, 9 a.m.