Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes encoding error and makes runnable on mybinder.org #4

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .binder/install.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

install.packages("reshape2")
install.packages("openxlsx")
install.packages("RColorBrewer")
install.packages("rootSolve")
install.packages("deSolve")
1 change: 1 addition & 0 deletions .binder/runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
r-2020-04-20
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# SEIR-model-Stockholm
Skattning av peakdag och antal infekterade i covid-19-utbrottet i Stockholms län februari-april 2020.

[![Binder](https://mybinder.org/badge_logo.svg)](https://gke.mybinder.org/v2/gh/FohmAnalys/SEIR-model-Stockholm/master?urlpath=%2Frstudio)
10 changes: 5 additions & 5 deletions Script/Estimate_SEIR_for_sharing_new_incidence.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ heading <- "
# R version: 3.5.2
#
# What the script does: This script estimates the parameters of the infectivity described in the report
# 'Skattning av peakdagen och antal infekterade i covid-19-utbrottet i Stockholms l�n'.
# 'Skattning av peakdagen och antal infekterade i covid-19-utbrottet i Stockholms län'.
# With these we are able to estimate the number of infectious individuals at different time points,
# the cumulative number of infected, and the estimated effective basic reproduction number.
# If you want to reproduce the results obtained, or change anything, first write the
Expand Down Expand Up @@ -119,8 +119,8 @@ load(file.path(data.path, "Sverige_population_2019.Rdata"))
Region_population <- dat_pop_region_totalt
r_name <- levels(Region_population$ARegion)

region_namn <- unlist(strsplit(r_name, split="s l�n"))
region_namn <- unlist(strsplit(region_namn, split=" l�n"))
region_namn <- unlist(strsplit(r_name, split="s län"))
region_namn <- unlist(strsplit(region_namn, split=" län"))
region_namn <- region_namn[-which(region_namn == "Riket")]

Region_population$ARegion <- region_namn
Expand Down Expand Up @@ -186,7 +186,7 @@ Estimate_function_Stockholm_only_local <- function(p_symp = 0.5, p_lower_inf = 0
## The time-dependent infectivity rate
beta_decrease <- function(t, delta, epsilon, theta){

t_b <- as.numeric(as.Date("2020-03-16")) - as.numeric(as.Date("2019-12-31")) # dagen f�r jobba hemma
t_b <- as.numeric(as.Date("2020-03-16")) - as.numeric(as.Date("2019-12-31")) # dagen får jobba hemma

res <- ((1-delta)/(1+exp(epsilon*(-(t-t_b)))) + delta)* theta

Expand Down Expand Up @@ -388,7 +388,7 @@ fit_cum_inf <- N - fit_S



## The mean prevalence same days as the H�lsorapport Stockholmsstudien (27th March to 3rd April)
## The mean prevalence same days as the Hälsorapport Stockholmsstudien (27th March to 3rd April)
Smittsamma <- fit_I_symp + fit_I_asymp #+ fit_E
SmittsammaF <- Smittsamma[40:47]
mean(SmittsammaF/N)
Expand Down