rm(list=ls())
library(ibmR)
times=seq(0,20,by=0.001);
model=new("scheduler")
#Human population
model=addPopulation(model,nbIndividuals=1000,evtCtctRate=0.1,intraSpecCtctRate=0.1,lifespan=1/70,name="Human");
#Environment
model=addEnvironment(model,seasonality=sin(times*2*pi),"Evt")
#Add pathogen
model=addPathogen(model,mutationRate=0.1,crossProtection=0,probaInfection=0.01,latencyPeriod=365/7,infectiousPeriod=365/7,recoveryPeriod=365/7)
matrixContact=matrix(1,1);
model=setMatrixContact(model,matrixContact)
simulateModel(model,times);
#Modulation of probability infection according to infection history
modulationProbaInfectionHistory<-function(proba,pPathogen){
return(proba);
}
#Environmental step function
stepEvt<-function(){
pathArray
for(k in 1:length(pathArray)){
pathArray[k]$Load=pathArray[k]$Load*(pathArray[k]$growth*seasonality(currentTime)-pathArray[k]$decay*seasonalityseasonality(currentTime));
}
if(rand()<mutationRate){
mutation();
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.