Skip to content

Example 2: Multi species model

Bui Thi Mai Anh edited this page Jan 15, 2016 · 19 revisions

A mosquito-borne disease with three host species

The SI model with demography of a mosquito-borne disease with three host species: the primary host (mosquito) and two unspecified species, reservoir1, reservoir2. The population is partitioned using two attributes: status and species leading to 2x3 compartments. The system of ODEs representing this model is:

The system of ODEs of SI multi-species model

The multi-species concern

The transition rate matrix of this concern is zero because there is no transition from one species to another one. This concern is defined in Kendrick language as below:


multiHostConcern := KEConcern new.
multiHostConcern 
     addAttribute: #species 
     value: #(#mosquito #reservoir1 #reservoir2).

The SI model with two species written in Kendrick language


| model  multiHostConcern|
	multiHostConcern := KEConcern new.
	multiHostConcern 
		addAttribute: #species 
		value: #(#mosquito #reservoir1 #reservoir2).
	model := KEModel new.
	model population: (KEPopulation size: 13000).
	model attributes: {(#status -> #(#S #I #R))}.
	model addParameter: #mu value: 12.17.
	model addParameter: #gamma value: 52.
	model addParameter: #beta value: 1.
	model addParameter: #lambda value: [ :aModel| 
		(aModel atParameter: #beta) * 
		(aModel atCompartment: {#status->#I}) ].
	model addEquation: 'S:t=mu*N - beta*S*I - mu*S' parseAsAnEquation.
	model addEquation: 'I:t=beta*S*I - (mu+gamma)*I' parseAsAnEquation.
	model addEquation: 'R:t=gamma*I - mu*R' parseAsAnEquation.
	model integrate: multiHostConcern.	
	model 
		atParameter: #mu
		assignValue: 
		[ :aModel| |c val| 
			c := aModel currentCompartment at: #species.
			c = #mosquito ifTrue: [ val := 12.17 ].
			c = #reservoir1 ifTrue: [ val := 0.05 ].
			c = #reservoir2 ifTrue: [ val := 0.05 ].
			val
		].
	model atParameter: #N assignValue: [ :aModel| |c| 
		c := aModel currentCompartment at: #species.
		aModel sizeOfPopulation: c
		].
	model addParameter: #rho value: [ :aModel| |c val|
		c := aModel currentCompartment at: #species.
		c = #mosquito ifTrue: [ val := #(0 0.02 0.02) ].
		c = #reservoir1 ifTrue: [ val := #(0.02 0 0) ].
		c = #reservoir2 ifTrue: [ val := #(0.02 0 0) ].
		val
		].
	model atParameter: #lambda assignValue: [ :aModel|
		((aModel atParameter: #beta) * 
		(aModel atParameter: #rho) * 
		(aModel atCompartment: {#status->#I})) sum
		].
	model atCompartment: { #status->#S. #species->#mosquito } put: 9999.
	model atCompartment: { #status->#I. #species->#mosquito } put: 1.
	model atCompartment: { #status->#R. #species->#mosquito } put: 0.
	model atCompartment: { #status->#S. #species->#reservoir1 } put: 1000.
	model atCompartment: { #status->#I. #species->#reservoir1 } put: 0.
	model atCompartment: { #status->#R. #species->#reservoir1 } put: 0.
	model atCompartment: { #status->#S. #species->#reservoir2 } put: 2000.
	model atCompartment: { #status->#I. #species->#reservoir2 } put: 0.
	model atCompartment: { #status->#R. #species->#reservoir2 } put: 0.

Custom sidebar of the Kendrick Wiki

Basic-SIR

SIR---Metapopulation

Clone this wiki locally