Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SEIR-Modell
#!/usr/bin/env Rscript # Epidemiologie SEIR Modell library(data.table) pEI <- 1/3 # probability to get infectuous after being expoesed pIR <- 1/7 # probability to recover when infectuous Tn <- 200 # Number of iterations (days) Population <- 83200000 # Population at start R0 <- 3 * pIR # Reproduction value at start (persons / day) options ( digits = 4 ) SEIR <- data.table( S = c( Population - 1 ,rep(0,Tn-1)) , E = c( 1 ,rep(0,Tn-1)) , I = rep( 0 , Tn ) , R = rep( 0 , Tn ) ) for (i in 2:Tn) { SEIR$R[i] <- SEIR$R[i-1] + SEIR$I[i-1] * pIR SEIR$I[i] <- SEIR$I[i-1] * ( 1 - pIR ) + SEIR$E[i-1] * pEI Infect <- R0 * SEIR$S[i-1] / Population * SEIR$I[i-1] if (Infect > SEIR$S[i-1] ) { Infect = SEIR$S[i-1] } SEIR$E[i] <- SEIR$E[i-1] * ( 1 - pEI ) + Infect SEIR$S[i] <- SEIR$S[i-1] - Infect } plot(SEIR$S , type="l" , col = "blue" , xlab = "Tag" , ylab = "Anzahl" , xlim = c( 50, Tn) , ylim = c(0, Population) , main = "SEIR Modell" ) grid() par ( new = TRUE ) plot(SEIR$E , type="l" , col = "orange" , xlab = "" , xlim = c( 50, Tn) , ylab = "" , ylim = c(0, Population) ) par ( new = TRUE ) plot(SEIR$I , type="l" , col = "red" , xlab = "" , xlim = c( 50, Tn) , ylab = "" , ylim = c(0, Population) ) par ( new = TRUE ) plot(SEIR$R , type="l" , col = "green" , xlab = "" , xlim = c( 50, Tn) , ylab = "" , ylim = c(0, Population) )
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Practice R programming
1
Not able to install packages
Paired t-test [Shear Strength of Girder]
Chi-squared tests of independence [Seat Belt Yes/No] worked
Call option formula for Geometric Laplace distributed stock
Kruskal Wallis test
Variance Gamma process 3
Practica1
Ch. 5: Cookie Chip Sampling
Please log in to post a comment.