-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodels_SIS.fsx
42 lines (32 loc) · 1.02 KB
/
models_SIS.fsx
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
#load "Setup.fsx"
open FSharp.Charting
// SIS = Susceptible Infected Susceptible
type Parameters =
{ contactRate : float
trasmissionRate : float
populationSize : float
cureRate : float }
let nextPeriodInfectedPeople p infectedPeople =
let W = infectedPeople
let N = p.populationSize
let c = p.contactRate
let t = p.trasmissionRate
let a = p.cureRate
W + W * (c * t * (N - W)/N - a)
// basic reproduction number
let r0 p =
let c = p.contactRate
let t = p.trasmissionRate
let a = p.cureRate
c * t / a
let goingToSpread p vaccinationPercentage =
r0 p > 1.0
let minimumVaccinationToNotSpread r0 =
1.0 - 1.0 / r0
let plot p periods initialInfectedPeople =
(float initialInfectedPeople)
|> Seq.unfold (fun infectedPeople -> Some(infectedPeople, nextPeriodInfectedPeople p infectedPeople))
|> Seq.take periods
|> Chart.Line
let p = { contactRate = 0.3; trasmissionRate = 0.3; populationSize = 100.0; cureRate = 0.1 }
plot p 1000 1