File:Simple SIR model.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file (SVG file, nominally 1,440 × 810 pixels, file size: 665 KB)

Captions

Captions

The proportion of the infected population and the basic reproduction number

Summary

[edit]
Description
English: The proportion of the infected population and the basic reproduction number. They are described by the simple SIR model
dS/dt = −βSI
dI/dt = βSI - γI
dR/dt = γI
with initial conditions I(0)/N = 1/10000000 and R(0)/N = 0 where N = S + I + R.
Date
Source Own work
Author ARAKI Satoru
 
W3C-validity not checked.
library(deSolve)
library(ggplot2)
library(latex2exp)

sir<-function(t, init, parms) {
  with(as.list(c(init, parms)), {
    # nondimensional form
    ds <- -R0*s*i
    di <- R0*s*i - i
    list(c(ds, di))
  }) 
}

s0 <- 1 - 10^(-7)
T <- 100
init <- c(s=s0, i=1-s0)
times <- seq(0, T, by=.01)

df <- function(R0) {
  parms <- c(R0=R0)
  out <- ode(init, times, sir, parms)
  df <- data.frame(t=out[,1], i=out[,3], R0=R0)
  df
}
data <- do.call(rbind, lapply(seq(1.0, 3.0, by=.2), df))

p <- ggplot(data, aes(color=sprintf("%1.1f", R0))) +
  geom_path(aes(x=t, y=i)) + 
  scale_x_continuous(limits=c(0, T), breaks=seq(0, T, by=10)) +
  scale_y_continuous(limits=c(0, .31), breaks=seq(0, .31, by=.05)) +
  labs(
    x=TeX("$\\gamma\\mathit{t}$"),
    y=TeX("$\\mathit{I}/\\mathit{N}$"),
    color=TeX("$\\beta\\mathit{N}/\\gamma$")
  ) +
  scale_fill_brewer("Spectral") +
  theme_minimal(base_family = "Times")

svg(filename="infected.svg", width=16, height=9)
plot(p)
dev.off()

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current03:50, 3 August 2020Thumbnail for version as of 03:50, 3 August 20201,440 × 810 (665 KB)ARAKI Satoru (talk | contribs)Changed fonts
20:40, 19 April 2020Thumbnail for version as of 20:40, 19 April 20201,440 × 810 (650 KB)ARAKI Satoru (talk | contribs)Corrected a legend.
18:27, 19 April 2020Thumbnail for version as of 18:27, 19 April 20201,440 × 810 (646 KB)ARAKI Satoru (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata