Infection Dynamic Model (Model Definition GUI)

From COSSAN Wiki
Jump to: navigation, search

This page shows how to prepare the Infection Dynamic Model in the Graphical User interface of COSSAN-X.

Input

Suppose to consider a small village with an initial population of 1000 individuals.

Parameter

In the GUI a parameters object named S0 is defined with a values = 1000 as shown in the figure:

InfectionParameter.png

Random Variables

Four Random Variable object are used to model different parameter of the Infection model. More specifically 3 random variables with uniformly distributed between 0 and 1 are used to model the infection coefficient, the recovery rate and the death rate respectively. The contact coefficient is modelled using a beta distribution with parameter 2 and 7.


Infectionrv1.png

Infectionrv2.png

Infectionrv3.png

Infectionrv4.png

Evaluator

A Matlab script is then used to model the infection spread coefficient (Y).

Matlab script (Single Array I/O)

In this example we use single array for the Input / Output interaction.

InfectionMio.png

Warning.png Order of the input factors
The order of the input factors defined in the Matlab script is important when Single Array is used



The following matlab script is used to model the infection spread coefficient.

% INPUT
% S0 if the first column of the matrix Minput
% gamma is the second column of the matrix Minput
% kappa is the third column of the matrix Minput
% r is the forth column of the matrix Minput
% delta is the fifth column  of the matrix Minput
% OUTPUT
% We have only 1 output that is the column of the matrix Moutput

% Y = gamma.*kappa.*Szero-r-delta;
  Moutput=Minput(:,2).* Minput(:,3).* Minput(:,1)-Minput(:,4) - Minput(:,5);

% The .* means Element-by-element multiplication

Matlab script (Structure I/O)

Alternative a Matlab script where the Input and Output are passes as a structure can be used. It is necessary to select the appropriate Matlab I/O type as shown below.


InfectionMio2.png

The Matlab script used is:

% Matlab Script Template

 % =========================================================================
% COSSAN working group, 
% E: info@cossan.co.uk
% W: www.cossan.co.uk 
% Copyright 1993-2016 
% =========================================================================

% Cycle over realizations (samples)
% % DO NOT REMOVE THIS CYCLE
for n= 1:length(Tinput)
	 % Insert your code here
	 % Example:  
	 Toutput(n).Y= Tinput(n).gamma*Tinput(n).kappa*Tinput(n).S0-Tinput(n).r-Tinput(n).delta;
	
end

Model

Finally a Physical Model is defined in the GUI. This can be easily created by adding the modelInfection evaluator to the Physical Model (i.e. using the + button in the evaluator section of the Physical Model editor).

InfectionModel.png

See Also