nosoi (version 1.0.0)

dualNone: Dual-host pathogen in homogeneous hosts populations

Description

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.

Usage

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)

Value

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

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.

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 dualDiscrete. For simulations with a structured population in continuous space, dualContinuous

Examples

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

test.nosoi
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab