deterministicmodel_inadjust_pandemictravel: This function gives a deterministic realization for n...

Description Usage Arguments Value Examples

Description

This function gives a deterministic realization for n countries with a given regulated strategy and quarantine duration required by the destination countries for all travel out countries. It also keeps track the number of new imported active confirmed cases and traveler status before and after done quarantine.

Usage

1

Arguments

thetamatrix

is a matrix of parameters, parameters of each country is on 1 row

inp

is a list include durationtravel : durationtravel (days), durationquarantine_adjustedin : number of days people travel in have to quarantine based on each country policy, travelregulated: a list of travel allowed from 1 country to another during the duration, initialmatrix is a matrix of initial compartments of countries, each country is on 1 row, and quarantinerate is the rate people follow quarantine

Value

The a stochastic realization of n countries with travel data regulated, also returns travelers status before and after quarantine, and active confirm update during the quarantine time

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## Not run: 
library(CONETTravel)
######function generating parameters with R0 in a given range
thetagenerating = function(lowerbound, upperbound){
tmp2 = 1 # need for kick off
while(tmp2 >0){
   theta = c( alpha0 = 0,alpha = runif(1,0,1),beta = runif(1,0,.25), delta=runif(1,0,.25),
           eta=1, gamma=runif(1,0,1) )
tmp1 = theta[2]/(theta[3] + theta[6])
 tmp2 = (tmp1 - lowerbound)*(tmp1 - upperbound)
}
return(theta)
}
############ function generate theta matrix
thetafunction <- function(numbercountries){
thetamat = matrix(0, nrow=numbercountries, ncol=6)
for(i in 1:numbercountries){
  thetamat[i,] = thetagenerating(0.47,6.47) # R0 belongs to .47, 6.47
}
return(thetamat)
}
###########initial matrix function
initialmatrix_func =  function(numbercountries){
 initialmatrix = matrix(0, numbercountries, 6)
for (country in 1:numbercountries){
 P = round(runif(1, 50000, 20000000000), digits=0)
I = round(runif(1, 0, 2000), digits=0)
 S = P - I
  initialmatrix[country,] = c(S, I, 0, 0,0,0)
}
 return(initialmatrix)
}
############function generate travel data
traveldata_func = function(P, numbercountries, travelrate, durationtravel){
 traveldata = matrix(0, nrow = durationtravel, ncol = numbercountries)
for( day in 1:durationtravel){
 for (country in 1:numbercountries){
   Totaltravel = P[country]*travelrate
     SdTotaltravel = Totaltravel*.05
     traveldata[day,country] = round(rnorm(1, Totaltravel, SdTotaltravel), digits=0)
   }
 }
 return(traveldata)
}
#############
numbercountries = 3 # choose the number of countries
initial_corona =  initialmatrix_func(numbercountries)
P = rowSums(initial_corona)
travelrate = 40/(365*328) #a given travel rate each day
durationtravel = 84 # number of days travel
travelout_data = traveldata_func(P, numbercountries, travelrate, durationtravel)
#generate theta matrix for each countries
thetamatrix = thetafunction(numbercountries)
ratein = 1 # policy that allows full rate of travel in
traveloutDivideRegulated = totaltravelout_samerate_regulated(travelout_data, ratein, P)
inp = list(durationtravel = durationtravel, travelregulated = traveloutDivideRegulated,
          initialmatrix = initial_corona, quarantinerate = 1, durationquarantine_adjustedin = rep(14,numbercountries))
deterministicmodel_inadjust_pandemictravel(thetamatrix, inp)

## End(Not run)

leminhthien2011/CONETTravel documentation built on April 18, 2021, 4:17 a.m.