-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,458 additions
and
455 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[LocalizedFileNames] | ||
preprocess_data_EU_old.R=@preprocess_data_EU_old.R,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
|
||
runSimbinder = function(glhflows_input){ | ||
#3 times steps per day (8 hours), 40% chance of moving per time step | ||
HPop_out = runSim(HPop,pat_locator,glhflows_input,glhflows_input,movement_data, input_dates,recover_df, exposerate,exposepd,exposed_pop_inf_prop = 0, TSinday = 3,prob_move_per_TS=.4) | ||
HPop_out | ||
} | ||
|
||
source("bearmod_fx_dev_EU_version.R") | ||
source("preprocess_data_EU.R") | ||
#Initial parameters | ||
NPat = length(patNames) | ||
patnInf = rep(0,NPat) | ||
patnExp = c(rep(0,NPat) ) | ||
|
||
pat_locator$country = substr(pat_locator$patNames,1,2) | ||
|
||
r0vals = read.csv("pop_data_NPI_startDate_v2.csv") | ||
|
||
recprob = 1/4 | ||
recrate = 1-exp(-1/4) #daily probability of recovery | ||
exposerate = 1 # This is set to 1 because we will set exposure rates on a NUTS3-level basis (ie. accounting for country-level heterogeneity in R0) | ||
|
||
pat_locator$ISO3 = countrycode(pat_locator$country,origin="eurostat",destination="iso3c") | ||
pat_locator$r0 = 0 | ||
#define country-level R0 | ||
for (i in 1:dim(pat_locator)[1]){ | ||
pat_locator$r0[i] = subset(r0vals,iso3c ==pat_locator$ISO3[i])$R0.ML | ||
} | ||
|
||
#read in cases on March 20 across Europe | ||
patinfdata = read.csv("nuts3_cases_320.csv",stringsAsFactors=F) | ||
|
||
#define cases based on cases on march 20 across all NUTS3 areas | ||
for (i in 1:length(patNames)){ | ||
patnInf[which(patinfdata$NUTS_ID == patNames[i])] = patinfdata$nuts3_cases[i] | ||
} | ||
library(viridis) | ||
|
||
|
||
#Repeat mobility data to add 6 months to the end of the Google NUTS3 dataset | ||
movement_data$weekyr = paste("1",movement_data$V2+1,movement_data$V1,sep="-") | ||
movement_data=subset(movement_data,V2<52) | ||
movement_data$dateorig = as.Date(movement_data$weekyr,format="%w-%W-%Y") | ||
movement_data$date = movement_data$dateorig + months(2) | ||
|
||
movement_data_add = subset(movement_data,date>"2019-03-08") | ||
movement_data_add$date = movement_data_add$date + months(3) | ||
movement_data = rbind(movement_data,movement_data_add) | ||
movement_data_add$date = movement_data_add$date + months(3) | ||
movement_data = rbind(movement_data,movement_data_add) | ||
#Because the Google NUTS3 dataset is from 2019, we will add one year to simulate 2020 | ||
movement_data$date = movement_data$date + years(1) | ||
|
||
start_date = as.Date("2020-03-20") | ||
movement_data = subset(movement_data,date>(start_date - weeks(1))) | ||
end_date = as.Date("2020-03-20") + weeks(30) | ||
movement_data = subset(movement_data,date < end_date) | ||
input_dates=seq(start_date,end_date,by="days") | ||
recover_df = data.frame(date = input_dates,recrate = recprob) | ||
|
||
#This dataset records the relative movement in a given week, compared to a baseline, for 2020 (Recording reductions in movement due to COVID-19) | ||
glhflows = read.csv("glh flow data_NUTS3_EU.csv",stringsAsFactors=F) | ||
glhflows = glhflows[c("NUTS3fr","t1","change")] | ||
glhflows_fillin = expand.grid(NUTS3fr = pat_locator$patNames[!is.element(pat_locator$patNames,glhflows$NUTS3fr)], t1 = unique(glhflows$t1) ) | ||
glhflows_fillin$change = 0 | ||
#for areas that did not have a reduction recorded, we used the mean value observed across all NUTS3 areas | ||
#note: t1 represents the first day of a given week -- ie. "01/03/2020" means the movement observed from March 1 to March 7 | ||
for (date in levels(glhflows_fillin$t1)){ | ||
print(date) | ||
glhflows_fillin$change[glhflows_fillin$t1 == date] = mean(glhflows$change[glhflows$t1 == date]) | ||
} | ||
|
||
glhflows_all = rbind(glhflows,glhflows_fillin) | ||
glhflows_all = merge(glhflows_all,pat_locator[c("patNames","r0","country")],by.x="NUTS3fr",by.y="patNames") | ||
glhflows_all$change[is.na(glhflows_all$change)] = mean(subset(glhflows_all,t1 == "08/03/2020")$r0,na.rm=T) | ||
#new NUTS3-specific contact rate calculated by also accounting for locak R value | ||
glhflows_all$relative_contact = glhflows_all$change * glhflows_all$r0 * recrate | ||
glhflows_all$relative_move = glhflows_all$change | ||
glhflows_all$date = dmy(glhflows_all$t1) | ||
#NUTS3 areas with no lockdown inherited the movement patterns from March 1 | ||
glhflows_nolockdown = subset(glhflows_all,t1=="01/03/2020") | ||
|
||
|
||
|
||
glhflows_lockdown = subset(glhflows_all,t1=="22/03/2020") | ||
#We extended the lockdown effect one further week into April, to account for additional community uptake of lockdown | ||
glhflows_lockdown_extra = subset(glhflows_all,t1=="22/03/2020") | ||
glhflows_lockdown_extra$change =glhflows_lockdown_extra$change *.75 | ||
#Both contact rates and movement reduced based on reductions in movement observed in the Google COVID-19 dataset | ||
glhflows_lockdown_extra$relative_contact = glhflows_lockdown_extra$change * glhflows_lockdown_extra$r0 * recrate | ||
glhflows_lockdown_extra$relative_move = glhflows_lockdown_extra$change | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
Name,Code | ||
Afghanistan,AF | ||
Åland Islands,AX | ||
Albania,AL | ||
Algeria,DZ | ||
American Samoa,AS | ||
Andorra,AD | ||
Angola,AO | ||
Anguilla,AI | ||
Antarctica,AQ | ||
Antigua and Barbuda,AG | ||
Argentina,AR | ||
Armenia,AM | ||
Aruba,AW | ||
Australia,AU | ||
Austria,AT | ||
Azerbaijan,AZ | ||
Bahamas,BS | ||
Bahrain,BH | ||
Bangladesh,BD | ||
Barbados,BB | ||
Belarus,BY | ||
Belgium,BE | ||
Belize,BZ | ||
Benin,BJ | ||
Bermuda,BM | ||
Bhutan,BT | ||
"Bolivia, Plurinational State of",BO | ||
"Bonaire, Sint Eustatius and Saba",BQ | ||
Bosnia and Herzegovina,BA | ||
Botswana,BW | ||
Bouvet Island,BV | ||
Brazil,BR | ||
British Indian Ocean Territory,IO | ||
Brunei Darussalam,BN | ||
Bulgaria,BG | ||
Burkina Faso,BF | ||
Burundi,BI | ||
Cambodia,KH | ||
Cameroon,CM | ||
Canada,CA | ||
Cape Verde,CV | ||
Cayman Islands,KY | ||
Central African Republic,CF | ||
Chad,TD | ||
Chile,CL | ||
China,CN | ||
Christmas Island,CX | ||
Cocos (Keeling) Islands,CC | ||
Colombia,CO | ||
Comoros,KM | ||
Congo,CG | ||
"Congo, the Democratic Republic of the",CD | ||
Cook Islands,CK | ||
Costa Rica,CR | ||
Côte d'Ivoire,CI | ||
Croatia,HR | ||
Cuba,CU | ||
Curaçao,CW | ||
Cyprus,CY | ||
Czech Republic,CZ | ||
Denmark,DK | ||
Djibouti,DJ | ||
Dominica,DM | ||
Dominican Republic,DO | ||
Ecuador,EC | ||
Egypt,EG | ||
El Salvador,SV | ||
Equatorial Guinea,GQ | ||
Eritrea,ER | ||
Estonia,EE | ||
Ethiopia,ET | ||
Falkland Islands (Malvinas),FK | ||
Faroe Islands,FO | ||
Fiji,FJ | ||
Finland,FI | ||
France,FR | ||
French Guiana,GF | ||
French Polynesia,PF | ||
French Southern Territories,TF | ||
Gabon,GA | ||
Gambia,GM | ||
Georgia,GE | ||
Germany,DE | ||
Ghana,GH | ||
Gibraltar,GI | ||
Greece,GR | ||
Greenland,GL | ||
Grenada,GD | ||
Guadeloupe,GP | ||
Guam,GU | ||
Guatemala,GT | ||
Guernsey,GG | ||
Guinea,GN | ||
Guinea-Bissau,GW | ||
Guyana,GY | ||
Haiti,HT | ||
Heard Island and McDonald Islands,HM | ||
Holy See (Vatican City State),VA | ||
Honduras,HN | ||
Hong Kong,HK | ||
Hungary,HU | ||
Iceland,IS | ||
India,IN | ||
Indonesia,ID | ||
"Iran, Islamic Republic of",IR | ||
Iraq,IQ | ||
Ireland,IE | ||
Isle of Man,IM | ||
Israel,IL | ||
Italy,IT | ||
Jamaica,JM | ||
Japan,JP | ||
Jersey,JE | ||
Jordan,JO | ||
Kazakhstan,KZ | ||
Kenya,KE | ||
Kiribati,KI | ||
"Korea, Democratic People's Republic of",KP | ||
"Korea, Republic of",KR | ||
Kuwait,KW | ||
Kyrgyzstan,KG | ||
Lao People's Democratic Republic,LA | ||
Latvia,LV | ||
Lebanon,LB | ||
Lesotho,LS | ||
Liberia,LR | ||
Libya,LY | ||
Liechtenstein,LI | ||
Lithuania,LT | ||
Luxembourg,LU | ||
Macao,MO | ||
"Macedonia, the Former Yugoslav Republic of",MK | ||
Madagascar,MG | ||
Malawi,MW | ||
Malaysia,MY | ||
Maldives,MV | ||
Mali,ML | ||
Malta,MT | ||
Marshall Islands,MH | ||
Martinique,MQ | ||
Mauritania,MR | ||
Mauritius,MU | ||
Mayotte,YT | ||
Mexico,MX | ||
"Micronesia, Federated States of",FM | ||
"Moldova, Republic of",MD | ||
Monaco,MC | ||
Mongolia,MN | ||
Montenegro,ME | ||
Montserrat,MS | ||
Morocco,MA | ||
Mozambique,MZ | ||
Myanmar,MM | ||
Namibia,NA | ||
Nauru,NR | ||
Nepal,NP | ||
Netherlands,NL | ||
New Caledonia,NC | ||
New Zealand,NZ | ||
Nicaragua,NI | ||
Niger,NE | ||
Nigeria,NG | ||
Niue,NU | ||
Norfolk Island,NF | ||
Northern Mariana Islands,MP | ||
Norway,NO | ||
Oman,OM | ||
Pakistan,PK | ||
Palau,PW | ||
"Palestine, State of",PS | ||
Panama,PA | ||
Papua New Guinea,PG | ||
Paraguay,PY | ||
Peru,PE | ||
Philippines,PH | ||
Pitcairn,PN | ||
Poland,PL | ||
Portugal,PT | ||
Puerto Rico,PR | ||
Qatar,QA | ||
Réunion,RE | ||
Romania,RO | ||
Russian Federation,RU | ||
Rwanda,RW | ||
Saint Barthélemy,BL | ||
"Saint Helena, Ascension and Tristan da Cunha",SH | ||
Saint Kitts and Nevis,KN | ||
Saint Lucia,LC | ||
Saint Martin (French part),MF | ||
Saint Pierre and Miquelon,PM | ||
Saint Vincent and the Grenadines,VC | ||
Samoa,WS | ||
San Marino,SM | ||
Sao Tome and Principe,ST | ||
Saudi Arabia,SA | ||
Senegal,SN | ||
Serbia,RS | ||
Seychelles,SC | ||
Sierra Leone,SL | ||
Singapore,SG | ||
Sint Maarten (Dutch part),SX | ||
Slovakia,SK | ||
Slovenia,SI | ||
Solomon Islands,SB | ||
Somalia,SO | ||
South Africa,ZA | ||
South Georgia and the South Sandwich Islands,GS | ||
South Sudan,SS | ||
Spain,ES | ||
Sri Lanka,LK | ||
Sudan,SD | ||
Suriname,SR | ||
Svalbard and Jan Mayen,SJ | ||
Swaziland,SZ | ||
Sweden,SE | ||
Switzerland,CH | ||
Syrian Arab Republic,SY | ||
"Taiwan, Province of China",TW | ||
Tajikistan,TJ | ||
"Tanzania, United Republic of",TZ | ||
Thailand,TH | ||
Timor-Leste,TL | ||
Togo,TG | ||
Tokelau,TK | ||
Tonga,TO | ||
Trinidad and Tobago,TT | ||
Tunisia,TN | ||
Turkey,TR | ||
Turkmenistan,TM | ||
Turks and Caicos Islands,TC | ||
Tuvalu,TV | ||
Uganda,UG | ||
Ukraine,UA | ||
United Arab Emirates,AE | ||
United Kingdom,GB | ||
United States,US | ||
United States Minor Outlying Islands,UM | ||
Uruguay,UY | ||
Uzbekistan,UZ | ||
Vanuatu,VU | ||
"Venezuela, Bolivarian Republic of",VE | ||
Viet Nam,VN | ||
"Virgin Islands, British",VG | ||
"Virgin Islands, U.S.",VI | ||
Wallis and Futuna,WF | ||
Western Sahara,EH | ||
Yemen,YE | ||
Zambia,ZM | ||
Zimbabwe,ZW |
Oops, something went wrong.