-
Notifications
You must be signed in to change notification settings - Fork 14
Example 5: SIR Concern, demography concern and vaccination at birth concern
Bui Thi Mai Anh edited this page Jul 3, 2018
·
1 revision
Suppose that a part of newborn individuals has been vaccinated and enter directly to the immune class R. The model below is composed of three concerns: SIR Concern, demography concern and vaccination concern.
|birthVaccConcern demogConcern sirConcern model simulator db|
sirConcern := KEConcern new.
sirConcern attributes: { #status->#(S I R) }.
sirConcern addParameters: { #beta. #gamma }.
sirConcern
addTransitionFrom: '{#status: #S}'
to: '{#status: #I}'
probability: [ :aModel |
(aModel atParameter: #beta) *
(aModel atCompartment: {#status->#I}) ].
sirConcern
addTransitionFrom: '{#status: #I}'
to: '{#status: #R}'
probability: [ :aModel | aModel atParameter: #gamma ].
demogConcern := KEConcern dependOn: sirConcern.
demogConcern addParameter: #mu.
demogConcern
addTransitionFrom: { #status->#S }
to: #empty
probability: [ :aModel| aModel atParameter: #mu ].
demogConcern
addTransitionFrom: { #status->#I }
to: #empty
probability: [ :aModel| aModel atParameter: #mu ].
demogConcern
addTransitionFrom: { #status->#R }
to: #empty
probability: [ :aModel| aModel atParameter: #mu ].
demogConcern
addTransitionFrom: #empty
to: { #status->#S }
probability: [ :aModel| aModel atParameter: #mu ].
birthVaccConcern := KEConcern dependOn: demogConcern.
birthVaccConcern addParameter: #p.
birthVaccConcern
addTransitionFrom: #empty
to: {#status->#R}
probability: [ :aModel| (aModel atParameter: #mu)*(aModel atParameter: #p) ].
birthVaccConcern
updateTransitionFrom: #empty
to: {#status->#S}
probability: [ :aModel| (aModel atParameter: #mu)*(1-(aModel atParameter: #p)) ].
model := KEModel new population: (KEPopulation size: 10000).
model integrate: sirConcern.
model integrate: demogConcern.
model integrate: birthVaccConcern.
model atCompartment: { #status->#S } put: 9999 atOthersPut: 0.
model atCompartment: { #status->#I } put: 1.
model atCompartment: { #status->#R } put: 0.
model atParameter: #beta assignValue: 0.052/365.
model atParameter: #gamma assignValue: 1/7.
model atParameter: #mu assignValue: 1/(70*365).
model atParameter: #p assignValue: 0.7.
simulator := KESimulator new: #RungeKutta from: 0.0 to: 100*365 step: 1.
simulator executeOn: model.
db := KEDiagramBuilder new.
db data: (simulator timeSeriesAt: '{#status: #I}') log.
db yLabel: 'log of infectious'.
db open