Welcome back.
So this video is meant to provide you
with two simple examples of how
to use the modeling recipe that we just saw.
Of course, as I build a model,
I need to use certain modeling tools.
So I'll focus this video on our first type of models
which are called compartmental models,
so examples of compartmental models.
And this goes back to video two on the modeling recipe.
So the second video for this week
where I gave the example that when we look at a system,
and we wanna decide which are our parts
and what distinguishes them, it's sort of like trying
to tidy up a room where you wanna put items
in boxes that makes them easy to find in the future.
So you want, you know, all the toys to be with the toys,
all the books to be with the books
and compartmental models are really just
a formalization of this idea.
So compartments are different boxes.
And then we wanna put different parts
of our system in there.
So the way these examples
are gonna look is always the same.
We're gonna literally draw boxes
and then draw the interactions
between the parts as arrows between the boxes.
So let me just formalize this a little bit.
So compartments
will be boxes
where the assumption
of a homogeneous behavior hold.
So anytime you hear about compartmental model,
that homogeneous behavior is assumed
within a given compartment.
So every part, every element that we're gonna put
in the same compartment are assumed
to behave in the exact same way.
And different compartments then are just meant
to formalize this intuition
of heterogeneous behaviors in the system.
And then everything else, the model itself,
or the mechanism
will simply be arrows
that define flows of the parts.
So all of the interactions will be arrows
that tell you how elements flow
from one box to another
as their behavior change
or their state changes, something like that.
So it's boxes
and arrows.
That's really all this first tool is gonna be.
So first, our first example will be something really,
really simple, people walking in and out of a building.
This could also be to be more historically accurate,
could also be a drug compound
injected in an organ.
I'm saying this because a lot of the theory
and the process of compartmental modeling
was invented as part of pharmacokinetics.
So this study of how drug compounds or molecules
can be injected into an organ, diffuse around the body.
So then the different boxes would be different organs
and flows between them
would be obviously different bloodstreams.
This is very similar actually here.
Let's stick with the example
of people walking in and out of a building.
But really, everything that we're gonna do here,
could be applied to drug compounds.
And I'll try and keep the analogy going
throughout this, but just for now.
So all we care about really is this.
So we have this human population, that's our whole.
The only space we care about
is sort of binary here which is rare.
All we care about is whether people are
in this building of interest or not really, so in or out.
That's all we care about.
And time seems like it's left for us to decide,
so it could obviously be discrete.
So maybe if we have data about how many people entered
the building every hour,
we could use hour increments for time.
It could be discrete, or it could be continuous
if we know sort of the rate
at which people enter and leave.
It doesn't matter too much apparently
Parts will be people
distinguished
by whether they're
in or out of that building.
In or out.
And then interactions between the part,
I'll just leave that unknown for now.
Okay, so then, the idea behind compartmental modeling
is to represent this intuition in just a simple schematic.
And we're gonna be doing this time
and time again with different systems.
So then, we're distinguishing our population
and whether it's in or out.
So there's actually two different conditions
that we could implement here.
And it depends on whether we want an open population
or a closed population, which is a step in this definition
of the whole that I just like skipped over.
So with all that, assume, let me erase this here.
And then the step that is here for how we're gonna draw this
as a compartmental model is
whether we're dealing with an open
or a closed population.
Okay. So what we said is that all that matters
is whether people are in the building or not.
So in the open population,
essentially, we're only gonna model the building,
and we're gonna say we don't know what's going on out there.
It's a scary world.
So we're gonna have flows of people coming in,
but we don't know where they're coming from.
Whereas the closed population is gonna have two boxes,
two compartments for within the building
and people outside of the building.
And that's gonna be slightly different
in terms of how we model that.
So one single compartment, one single box here,
usually I wouldn't label things explicitly,
but this is people in the building.
And then the way this behaves
is simply that you have some people coming in,
let's say, at rate alpha.
Within this building, we're gonna have a population
that we're gonna call N of T.
So every compartment always has one variable associated
with it that is allowed to change in time.
So here, I'm gonna use N for number
of people in the building.
People are coming in at rate alpha
and then people are gonna go out
and assuming at rate beta.
And I'm assuming that the more people
there are in the building,
the more people come out just simply
because if no one's in the building,
no one should be coming out.
So having this rate, this arrow here,
be proportional to N of T, just make sure
that I don't get negative numbers in my building.
Well, also, this is pretty simple.
You can already imagine how this would behave
as if initially there's no one in the building
through time.
The number of people in the building
would go up initially at rate alpha, right?
This which is a linear increase in time,
so N of T increases with time at rate alpha.
So that's the slope here, the initial slope,
then the slope starts slowing down because
as people come in, people start walking out
at this rate beta and eventually,
it's just gonna settle out.
Because beta times N of T will be equal to alpha.
So it's really just the flow
of the parts through different states
is what these compartmental models
are supposed to represent.
In a closed population,
it would be slightly different
because we could have the inside
of the building and now, let me draw a nicer square.
The outside of the building,
lemme start over here.
Nice square for compartment one, (laughing)
like too bad for the automatic shape, okay.
Okay, so we have one compartment for the inside,
let's say, and one for the outside.
And now as I said, in a closed system,
no arrows come directly from the outside.
We're modeling a complete universe.
So we're gonna have people that are outside that go
in the building and people that are in that go outside.
And then the key part here is that
because we have a closed system,
we have a fixed population,
there's a total of let's call them NT
for the total number of people in the population.
And that's not a dynamical variable.
That's just like 100 people.
That's all there is in this little imaginary universe.
So inside, we still have N of T and then outside,
we would have NT minus N of T people,
so that the sum of people inside
and outside are fixed at all time.
And now, we could have, we could imagine that we have a rate
at which outside people choose to go in,
which is again, now proportional
to this NT minus N of T, number of people outside.
So let's say, we call that NO for outside of T.
Here, we would have now, alpha NO of T
and again, beta N of T here.
And this model will be slightly different, right?
So by choosing open or closed systems,
we've built some approximations
or some assumptions about this population.
In subsequent videos, especially next week,
we'll see like how to go
from these little schematic cartoons
to actual mathematical equations
or how to model these systems using stochastic codes.
But most of which we care about is in designing
the cartoons of boxes and arrows.
So let's do a more involved example
before we end this video.
So simple disease models, right?
So I think I already said it here.
We care about a human population
and what's gonna be important
is whether people are sick or healthy.
So the whole is a human population
Oops, population,
and the classic model that are still mostly used
to this day to forecast COVID,
we're gonna assume what I call a fully connected population
which really you could think of as either everyone
is either that there's no space,
everyone is in one point,
or you have a fully connected network.
I like to think of anything, everything as network.
So that's our space, right?
So if you have different people,
well, everyone is connected to everyone,
like I would just be drawing a really big mess here.
But that's essentially what we're dealing with.
Anyone can infect anyone.
Okay, let me remove my mess.
And time,
here, again, I'll leave it free for here.
It doesn't matter too much.
It really matters once we start writing down equations
or, but often we talk in terms
of per-contact transmission rate.
So we could assume a discrete time systems
where at every time step,
some contact sucker in the population.
The parts are going to be people again
distinguished by their epidemiological state.
So we're gonna have, let me do, in the simplest case,
we would have what we called susceptible people,
meaning healthy and susceptible.
They could potentially be infectious,
and that's usually just called S.
And we're gonna have infectious individuals,
usually called I.
So in epidemiological compartmental models,
what I'm about to draw would be a potentially a SI model.
So we have two boxes.
Box for how many people are susceptible,
and a box in red here for how many people are infectious.
And then I'm assuming a closed population, let's say.
So I'm gonna add here, in my whole,
I sort of skipped a step that's important.
So I'm gonna assume a closed population.
If I'm modeling something like COVID on the UVM campus
for this week, that might be a fine approximation.
If I'm modeling COVID over the next 10 years,
then I wanna have some birth-death process.
Maybe some new students coming in, students coming out.
So then there's a lot of exchange
with the rest of the world.
So really, this closed population here
is a matter of timescale.
If we're thinking about the campus over a week,
it's fine to think it's closed.
Okay, so how is this gonna work out?
We're gonna have S of T variable associated
towards susceptible and I of T variable associated
with our infectious individuals.
Now, we need to think at what rate do susceptible,
so people that could be infected do become infectious?
Well, a little bit like people leaving the building,
we're just gonna assume a rate at which the event occur.
So let's call it beta
and like people in the building, again,
if there's no susceptible individual,
no one can leave, right?
This isn't something flowing from the outside,
so I'm gonna put a S of T
because the more susceptible people I have,
the more I imagine that they will get infected, right?
Disease incidents is usually this per-capita kind of thing.
So to get the actual number of new infections,
you multiply it by the total susceptible population S of T.
Well, similarly, you can make the argument that
if no one's infectious, no one's gonna get infected, right?
And similarly, if you have 10 times more infectious people
on campus, you get 10 times more contact
with infectious people,
10 times more likely to get infected.
So this rate really here is this non-linear term,
beta times S of T times I of T,
and I call it a non-linear term
because we have a closed population.
So we have a constraint here
that I'm gonna write in the margin.
That S of T plus I of T is equal to NT,
same as in our previous example.
We have a total population that is gonna
be fixed in time, not going to change.
So really, I could have written I of T as NT minus S of T
or S of T as NT minus I of T.
It doesn't matter too much.
But if you do that, what you realize is that this rate here
in the middle, beta times S times I is really something
like beta times S times NT minus S.
So you do have some S square term
that's gonna create some interesting behavior
when we start studying
the dynamical behaviors of these models.
So that would be a simple SI model.
It's kind of ridiculous in practice
'cause here, we're assuming there's no interaction
out of the I of T compartment.
So people are infectious forever.
So the only way this model would end is
with the population fully infectious.
In practice, we know that people do recover
from most disease.
So we could imagine having an arrow back
to the susceptible population.
So that could be something like the common cold,
maybe, when you do recover,
you can get it again.
And then this would happen,
maybe at a rate, gamma times I of T.
And now, we would have what we call the classic SIS model.
It's SIS because individuals go
from susceptible to infectious to susceptible.
If we wanna think about COVID,
hopefully, the situation looks actually more like this.
We would have a third state
that we would call recovered individuals
and then infectious individuals would go here.
And I think you're starting to see why,
and I just added a state here, recovered in black
which I'm calling R.
I think you're starting to see why I say that.
When you look at these cartoons,
once you've seen enough of them
or done enough of them,
you really start understanding what is
the question people are trying to answer.
What assumptions are they making, right?
If you see just the two boxes for a disease model,
you know you gotta have healthy and sick.
So you're assuming that people like,
go back from sick to being healthy.
If you see a third box, you know what they're assuming.
Looking at the mechanisms, right,
is really helping you see the different flows.
If we add an open population,
let me just cross this out, right?
If we add an open population,
then maybe we would have a migration
of susceptible individual here at some rate alpha.
And doing so, would tell you
that I'm either thinking on a longer time scale.
I'm thinking about a town and people coming
into town over, you know, months or something.
It does tell you about what I care about.
So I'll leave it at that for this video,
like constructing these models
and drawing these boxes is something
we're gonna do for a long time.
And I think this week,
we're just gonna run through a lot of examples,
trying to see how we map our assumptions
to actual assumptions and approximations
to actual models as boxes and arrows
with these compartmental models.
So I'll see you in class for the discussion.