In this video
what I really want to do is
to start giving you an intuition
for how we go from a compartmental model,
represented as boxes and arrows,
to a mathematical description.
And as a start we're gonna be thinking
about discreet dynamical systems,
meaning they're discreet both
in terms of types
of parts in the system.
So in terms of a discrete number of boxes,
but also discrete in time.
So this week we're gonna look at mathematical description
and also how to simulate these processes.
To keep with the theme of the previous video,
for now let's stay
within the realm of disease model.
We're gonna look at a simpler model.
Which is called the SIS model.
Meaning that unlike the SIR,
here we're only gonna have
two different boxes.
And with flow of density of population
that go both ways.
So we're still gonna have our susceptible box
for people not currently infectious,
and our infectious box
for people currently infectious.
The key difference with the SIR is
that the second arrow
on the one at the bottom here,
which corresponds to recovery,
people leaving the infectious state,
doesn't go to a new immune box
but goes back to the susceptible population.
So this could be something more like the common cold
where when you recover
you might not have long-lasting immunity
and you could get infected again,
sometimes just a week later.
Right?
So there are different ways
that people would put weight
or describe these arrows.
We could look at each arrow
in terms of the mechanism
that's really taking place.
So in terms of infection really is that we go
from a pair SI of individual,
so one susceptible,
one infectious,
to two infectious individual.
And that might occur at some rate, beta for example.
And in the case of recovery,
then we simply go from one infectious individual
to one susceptible.
And that might occur at some rate, gamma.
This is different
from what I used last week.
And in a minute I'll explain the difference.
Really the key part here is that
when we're gonna start reading papers
that use compartmental models,
there's no clear standard
on how to represent these boxes and arrows.
So you have to try and understand
what the authors really mean
by their representation.
So let's imagine
that we know some initial state
of the system.
Right?
Like these models,
they all have the same recipe.
You define your compartments
and arrows.
Then you initialize them to some value.
So let's say that we know
the fraction of the population S of t,
that is susceptible at time t.
And I of t, meaning infectious at time t.
And these could be,
as I said,
fraction of the population.
So between 0 and 1
or they could both be
between 0 and N
for a total population of N.
So let's say that they are numbers
of susceptible and infectious individuals.
Then to get a dynamical system
in discrete time.
What we want to ask is,
"If I go from time t
to time t plus 1,
how many susceptible individuals do I have?"
Well I know who is susceptible
at time t.
And the ones that are still susceptible
are those that have not been infected
by any of their infectious contact.
Right?
So every single susceptible individual here,
remember that there's no space
in these compartmental models.
So every susceptible individual is
in contact with all I infectious individual.
So if I have 100 infectious individual
that's 100 infectious contact.
And the only way for me to remain susceptible,
is for all of those infectious contact
to not transmit the disease.
So if we call beta,
the probability that an infectious individual transmit
to a susceptible individual.
The probability that they don't,
is simply 1 minus beta.
If there's a 10% chance
that it transmit,
there's a 90% chance that it doesn't.
And to stay susceptible,
I need all of them
to not transmit the disease.
So if I have two contacts,
then that's 90% chance of not transmitting
from the first one,
90% chance from the second one.
That's 90% times 90%
of transmission from neither.
And if I have a number 100,
then that's 90% to the 100.
So that's what I have here.
And I also have a positive term.
So one way to look at this is that
when you have these arrows
that flow from one box to the next,
you should always have a negative term
for the flow that leaves the box.
So here there's a negative term
for the people that don't remain susceptible.
You should have a positive term
when it enters the box.
So I'm losing some
through transmission here,
corresponding to flow of water,
or density,
or number of people
out of my susceptible box.
And I'm gonna gain some here based on recovery.
So if this is my infection term,
I'm gonna have some recovery term
which is gonna correspond to
every infectious individual.
And with what probability did they recover
in one time step?
It's simply gamma, right?
So if they do recover,
then they flow out of the I box
and into the S box.
And then we could write the same thing
for I of t plus 1.
But see here,
I don't have any arrows
out of my boxes leading
to the outside world, right?
I have a closed population.
So I know
that for all time,
S plus I must always equal N.
There's nowhere to hide.
There's nowhere to go
for these people except S and I.
So I don't even have to write this other equation.
I simply know
that I at time t plus 1
is gonna be equal
to N minus S
at time t plus 1.
'Cause S and I always have to sum to 1.
And that's another key insight here,
is that even though we have two boxes
that doesn't mean
that we have two degrees of freedom
or two important variables
in our system.
Because it's a closed population,
we know there's a conservation
of population,
I plus S equals N.
And that's a constraint
that we can use to reduce the complexity
of the model,
and fix one variable
as a function of the other.
So in this case,
we have one constraint,
conservation of population.
Two compartments.
So we have two compartments minus one constraint,
one degree of freedom.
That's one way to think about this.
So it's really a one dimensional system.
The other thing I wanna talk about
in this video
before we discuss how to write this equation
in greater detail during the discussion group,
is the fact that we've made some approximations here.
Right?
I'm not...
For example,
in my recoveries,
really you might have wanted to write,
"Well what is the probability to get one recovery?
Two recovery?
Three recovery?"
And list all possible cases.
Here really,
this is just gonna be the average number
of recoveries
that you might expect.
Let me make that a little clearer
for you all.
I'm gonna create a new page.
So I have this SIS model.
And let's say that we have a very simple population
N equal 2,
right.
Only two people.
It's not gonna be a very interesting model.
Well,
I of t
in any discrete simulation
could only take
one of three values.
There's either no one infectious,
one person infectious,
or two people infectious.
Really,
in the mathematical description,
it's gonna be able to go freely
between 0 and 2
because we're not limiting,
in those previous equations,
we're not limiting the transition
to discrete values.
So you can have 1.5 infectious individual.
And what would that mean, right?
What does it mean if here I have S of t,
a number of susceptible
that might be discrete,
let's say by chance is equal to 50,
but I increase it
with these recovery events
by 1.5, right?
So now I'm saying that there's a fractional number
of infectious individual.
What does that mean?
Well consider it this way,
let's just focus on recoveries.
And if I of t is equal to 0,
well the only thing
that can happen is nothing.
I can't have any recovery
if I don't have infectious individual.
If I of t is equal to 1,
well now I can get 0 recovery
or 1 recovery.
Right?
This is gonna occur
with probability
1 minus gamma.
'Cause gamma is my recovery probability
per time step.
And this is gonna be
with probability gamma.
I'm gonna have one recovery.
If I of t is equal to 2,
well now have three possible cases
with probability,
1 minus gamma squared,
I'll have no recovery at all.
So if both infectious individuals are unlucky
and they both choose to not recover
or the system chooses to not have them recover,
I'll have no recovery.
And with probability
2 gamma,
1 minus gamma.
So this 2 is...
No N choose K
where it's 2 choose 1.
(instructor laughs)
So there are two ways
to get only one recovery.
And in both cases,
I need one of the sick individual
to not recover
which is with probably 1 minus gamma,
and the other to recover
with probability gamma.
So I have two ways
with probability gamma,
1 minus gamma,
each to have one recovery.
And I'll get two recoveries
with probability gamma squared.
Well, that's pretty simple.
The reason I'm going
through this right now is
that I wanna highlight one thing,
which is the average of all these cases.
And throughout this course
when we think about averages,
I know we all see it differently depending
on our background.
So I just wanna highlight
that an average is always the sum.
And by the way,
this capital sigma simply means sum.
So you're going over all possible outcomes
in this case.
And you're summing a quantity
times a probability.
And that's how you calculate the average of that quantity
over a probability distribution for it.
So here's how these averages work out, right?
So in the first case,
the average is simply gonna be 0.
Here.
Because my quantity is 0
with probability 1.
So that's not super interesting.
Let's look at this other case.
I of t equals 1.
Well with probability 1 minus gamma,
I have a quantity 0
of recovery.
And with probability gamma,
I have quantity 1 of recovery.
So that's an average of gamma.
Okay?
But that's gonna be fractional.
Right.
In the second case
with I of t equal to 2,
I'm gonna get again,
1 minus gamma squared
this terms disappear
'cause it's a quantity 0,
plus 2 gamma,
1 minus gamma times 1.
So that's the probability
of having one recovery
plus 2 gamma squared.
Then you can work out the math.
Right.
And this term here
that I'm highlighting
you're gonna get 2 gamma minus 2 gamma squared.
So the gamma squared term are actually gonna cancel out.
And what you're gonna be left
is simply this 2 gamma quantity.
So this is simply this average
that we had before.
Right?
No matter how many infectious individuals,
no matter matter how many cases I go through,
this term is always simply going
to be gamma times I of t.
So what we're doing here
with this approximation is following the average
of all possible future
for this system.
And often the reason why I'm describing this is
that I just wanna highlight
that this approximation
along with others that we're gonna see
are often called,
mean-field
approximations.
And what this means is that
I of t
and S of t,
now describe the average state
of all possible future.
So the average future of a system.
So one way to look
at this is that now,
whenever you're writing these equations
and you're considering, you know,
one susceptible individual in the system,
that individual is not actually connected
to I of t individuals here.
But connected to the average
or mean-field
of all possible states for that future.
And that's kind of a fuzzy thing
but really instead of thinking of it
as one susceptible individual connected
to some number of infectious individuals,
which is gonna be discreet.
What we have with a mean-field approximation
is one susceptible individual connected
to some weird,
I'm trying to draw a field here,
some cloud, right?
So some diffused description of the system.
That's one way to think about this.
But really what it means is
that we're only following the average state
of the system.
So that's what we often mean
by these mean-field approximations.
But that's as simple as this.
So these equations would be enough
to write a little code
that would iterate these equations.
The readings for the textbook
for this week go through
how to analyze discrete dynamical systems like this,
instead.
And the next few videos,
what I wanna focus on is how
to simulate discrete computational version
of this model.
And eventually how to go from there
to continuous dynamical system.
So I'll see you in the next one.