Bayesian Modeling Introduction
Transcript
I help to organize this webinar series. This webinar series from that is organized by the Committee on International Relations in the Statistics and Statistics Without Border and today it's my pleasure to introduce to you Professor Rob Diedon who is the professor of biostatistics with a drunk position in the faculty of veterinary medicine and the department of mathematics and statistics at the inverse of Calgary in Canada and much of his recent work has been in the area of infections. This is modeling, but he's also the interested in basin and completion is this experimental design. This is several surveillance methods, spatial temporal logging and statistical learning. He has published over 75 papers in peer-reviewed journals has started as a associated editor in a number of journals, for example, they turn off the riots, the fiscal, see the Royal Statistical Society series C and the Canadian Journal of Statistics.
He is going to talk to us today about an introduction to base and modeling of epidemics from population to individual level models. Rob, please, the floor, it's yours. But before, let me remind our participants that if you do have questions, please place them in the Q&A. And I will, read the questions for Rob. It's much easier for us if you do this in the Ko, in a then in the in the chat. Okay, so please drop the floor is yours.
Hey, thanks very much. Alex for the introduction and the invitation. It's a I know not to be, joining a very impressive set of speakers that you've, had on, this webinar series. So yeah, I'm going to talk today about epidemic models, which obviously been in the news a little bit over the last few years.
As I put this together, I found I was talking less about the Bayesian aspect. Then the actual model so much so forgive me if you come here to get an overview of Bayesian statistics but I'm gonna spend most of my time talking about the models and I'm going to try and give you sort of one overview of what we're trying to do with these models. But, with an emphasis on simple models, what are known as population level models and time permitting. We'll also talk about more complex models. Individual level models. Okay and as Alex says please feel free to put your questions in as we go along. So I'll break the, talk into 3 parts, little introduction. The most of the time probably on the population level models and then a bit on the individual level models. Okay, so there you is COVID-19. This is the stock image at least from the beginning of the.
Of the pandemic. And obviously this is something that's been very pressing in my field over the last few years. But we've been interested in infectious, all communicable diseases for a long time. There are lots of human diseases that we're interested in, some of them very serious like Ebola or SARS or HIV, some of them less serious, but still, you know, with some mortality attached things like measles and influenza.
And there's also a lot of interest in disease in the, in the livestock industries. And horticultural industries. Mainly not to do with public health, but more to do with what economics for start, but also animal welfare. And then also the models I'm going to talk about today. Have a lot of similarities to models that are used in ecology as well. So if you're thinking about invasive species, animals or plants, the way they spread. Through spatially through time.
That looks a lot like the way that diseases might spread spatially through time. And these models or extensions of these models we've also used to model things like fire. Spread another thing that's obviously big in the news at the moment. And, although I haven't really worked in this area, you can use these models for things like, you know, Computer viruses, social means, financial market contagion. As you went, I think about a year ago now I went to a talk. On Ponzi schemes. As part of the conference. I didn't seek this out. I was quite surprised to see that they use essentially SIr models. To model, So they're, there are although I'm gonna talk about diseases today. Hey, there are extensions outside as well. Okay, so the topic of today's talk He's really gonna be what we might call mechanistic models of disease transmission.
And I'm gonna separate these from the idea of statistical models. Statistical models in my mind are essentially models that you take off the shelf and apply. So lots of different systems, right? And they're usually mathematically derived, right? A linear model, your GLM. And from the statisticians point of view. How we feed that through to do things like significance tests or goodness, tests, right? But the derivation is really mathematical when if you go down to first principles. That's not the case here. The models here are built. With the biological or ecological mechanisms going on in mind, right? They weren't, they're quite old now. People have been using these models for over a hundred years. They don't, I think I'm right in saying that they weren't designed with the idea of data analysis in mind.
But obviously as a statistician I'm very interested in how we parameterize these models, inform them via data. One of the things that's special about these models is that the parameters. Generally are very easily interpretable in a biological, way, right? You have a parameter that represents your infectious period. How long you infectious for? You have a parameter that might represent your contact rate.
Or the, the rate at which disease transmits through the population as opposed to, you know, linear model where beta one is what happens if you increase x one by one unit after accounting for all. X 2 x 3 x 4 which are really mathematical interpretations in my mind and the mapped onto the system. That's how I see anyway. This has a big advantage. If you're especially at the beginning of say, an epidemic or a pandemic.
Because the fact that these parameters are so easily interpretable means that they can generally be estimated in a piecemeal fashion. And that was certainly done at beginning of COVID. Yeah, mathematical biologists would go to the literature. To look at estimates of the infectious period, right? And they go somewhere else to find estimates of the transmission, right? And you can estimate some of these parameters with experiments, that sort of thing as well. And then finally, The other thing I want to to flag up before we dive into the models is the use of these models. Is generally predominantly about simulation. We want to make a prediction, a projection, right?
We may want to forecast what's about to happen. Or we may want to simulate and then impose some sort of control strategy to see what happens if we vaccinate 30% of the population or 50% of the population. Right. Whereas, the things like risk factor assessment, you know, is my covariant significant that tends to take a secondary position in this field. It's not always, but generally. Now there are before I carry on just to point out. Well, I'm not gonna talk about today.
And that's all the other sort of. What we call disease surveillance methods for analyzing infectious disease data. And what it mean by that generally is taking as I say off the shelf, statistical methods that may have been designed for other. Situations and applying them to disease data. Right, so that might mean things like control type methods. Where you know, you're observing the number of cases of a disease that's going on every day and suddenly it takes off.
And you wanna identify when that change point is, right, which in terms of. Disease, epidemiology means when does an outbreak occur or when does, The influenza season start, right? Things like that. And then there are things like spatial, spatial temple disease mapping, which is essentially count regression accounting for spatial structure or other sorts of. Regression, longitude, no, that's all important stuff, but it's not what I'm talking about today. Okay, so these mechanistic models. Transmission models I'm talking about. You can, they're, whole suite of them. Rudely, I think you can divide them into sort of 4 different. Parts, right? And different people would do this in different ways, probably. But so my first, One here, I'm gonna talk about a lot today. Are these population level models? Sometimes they might be referred to as homogeneous models. And there's an underlying assumption in there.
That is essentially everybody is the same, you know, there's no gender effects or age effects or geographical effects about your risk of getting or passing on the disease. Everyone's the same and everybody comes into contact with everybody else. Purely randomly. Probably a very low rate. It's purely random, right? Hence the homogeneous model. And we will spend. These are very simplistic models in a way, but they're also extremely useful. And we'll spend that as I say, fair amount of time talking about those today. Then if you like, you can ratchet up the complexity. By putting in a bit of structure, right? So say you, your population into different sub populations or strata. So these may be different age categories or gender or.
Geographic regions. And essentially there you you assume that predominantly within the strata. One of these homogeneous models is driving. The infection, but you also allow for. Transmission between strata, which occurs at a different, normally much lower rate. Right, so you're adding a bit of structure to If you take that a bit further, you get to the other. Topic that I'm gonna try and address today, which is what I call individual level model, sometimes individual based models is what they're known of. Oh nice. And in these models it's more complex. If the chances of any particular infectious individual infecting any other particular susceptible individual are going to depend about upon covariance about the individuals concerned. So they may be things like, they may be things like gender, they may be things like, your spatial proximity.
To, an infectious individual. Okay. And then there's a fourth category, which I don't really work on very much. Which are which are also extremely popular. Which I think of as being very high dimensional, highly complex versions of these models. And ILM might have 5, 10 parameters in it. Hey, agent based models may have 50, a thousand parameters in. So you're really getting in deep and trying to mimic the behavior of your population and how the disease spreads within that. Right?
So you might be modeling. Commuting patterns in a human disease or things like that. These are obviously potentially more realistic, but they're also much harder to parameterize because you've got a lot of parameters. And if you get some of those important parameters wrong. They can actually end up being quite unrealistic, right? But that the 4 general types and like I say, the population level and the individual level already what I'm gonna try and talk about today. Couple of things also about the sort of what makes these models different to Dammal statistical models we might use. So the statistical language, it really comes down to this idea of non-independence of infection events, right? So if you think about. With these modules, what we're often doing either directly or indirectly. Is modeling the time at which something happens. We're modeling the time of infection, the time of removal.
Which sounds similar to Survivor. Except in survival analysis, you have an independence assumption. If you're modeling cancer, lung cancer, After you've accounted for covariates, you know, age lifestyle. My risk of getting lung cancer at any particular time doesn't depend on who else in the population has lung cancer. There's an independence there. That's not true with infectious diseases, right? If I. I mean a room with people who have influenza. My risk of getting influenza is much higher than if I'm in the same room and nobody has influenza in that. Room right so the response if you like affects the response of other individuals. So another way of thinking about that, you have some sort of feedback. Where infection drives infection. Okay. And that's one of the reasons we don't tend to use off the shelf statistical models, we use these more mechanistic models.
Okay. And then one final point. I am gonna show you a model in a minute. One final point is that a lot of the modeling that's done in infectious disease work is done in continuous time and I do that. Here I'm gonna use discrete time models. Okay, so my T is gonna be. an integer. So we sort of, if you like. Building our model to follow the data in some sense. It comes in daily or weekly. The actual process is obviously continuous, right? There's a time of day at which you get infected.
But we're gonna be ignoring that in these models. But all of the what I'm going to talk about today can be done with continuous time as well. Okay, so I wonder. I've actually hidden my Kind of, but I wonder if there are any questions. I can't see anything there. Oh, okay. So I will. No questions, Rob. You may go ahead. Move on just kinda There we go. Alright, so let's look at the population level. So I'm gonna talk about.
A model that you've probably heard of, which is the It is essentially the simplest non well not it's not quite true. It's going to say the simplest non-trivial. It's one of the simpler. Non check for your models. And it's probably the most commonly used model I would say. Right. And the basic idea with an SIR model is you have a population. And you assume that individuals in that population are in one of 3 states. Or quite often we refer to them as compartments, right?
And those 3 states are susceptible, infectious or removed. So you start off in the, susceptible state. Which means you can get the disease, you haven't got it yet. And then there's some transmission rate that determines your risk of moving into the infectious period. Sorry, the infectious state. Usually the way we do that is we say we've got some Transmission rate parameter beta. Or infectivity rate it's sometimes called. In our case, we're gonna want to estimate.
Then we multiply that by the number Here the number of infectious individuals. So the more infectious individuals there are at time t. The higher that rate is and often we standardize this by dividing through by the population size and we don't have to do that, but we often do. Just in this case, it's just a scaling factor, essentially. Now if we're unfortunate enough to be infected. Under this model we immediately become infectious. So we can start passing on the disease. As soon as we're infected. And then at some point we enter this removed state bar right and that occurs according to some removal rates, this gamma down here. Which also determines the, Infectious period so often we think of that in terms of one over gamma. Which actually gives you the the average infectious period. Okay. And just to make clear before I move on.
Notationally, I'm gonna use S. T to represent the number of individuals in each of those compartments, susceptible, infectious, removed. You can set this up so the Si and other proportions, right? So here. Yes, at any given point in time, S plus I plus R is gonna be called N, the population size. I'm assuming there's no birth, no deaths, no migration. Right. But you could set it up so that this equals one and you track the proportions over time.
And then one last thing that I want to say. So this, R is often referred to as the recovered state. More generally it's a removed state. What it means is you essentially Disconnected to the population in some sense. Right? You can't infect anybody, you can't be infected. So it can mean you've recovered and you've acquired immunity, but it might mean you've died. It might mean you've got into quarantine, right? So more generally, refer to this as a removed state rather than a only covered state.
Okay. Now think about how individuals gonna pass through that. Those states, it's very simple. I can write this down in terms of a set of difference equations. So the number of susceptible at time t plus one. Is going to be the number of susceptible. Current time point minus. Is IT star, which is gonna be the number of new infections at time t. Alright, so I, IT star and RT star. Represent those new infections, new removals.
Similarly, in terms of, I. The number infectious at time t plus one will that will equal the number currently infectious. Plus the new infections. Minus the new removals. Okay. And then they will pass into the removal state. So that RT plus one will equal our T. Plus RT star. Okay. Now I wanna set up some sort of stochastic mechanism that people get through this. I wish I should say that. So a lot of the time. When people model this they use ordinary differential equations in continuous time so all of that is deterministic. Away being statisticians, you can have a stochastic model that can capture some of the the uncertainty that we certainly see in disease data. So all the stochasticity essentially happens on this slide. If I think about the. The number of new infections. Well, they're at a given time point, the maximum number of new infections I can have.
Is going to be the number of susceptible at time t. And then that's gonna happen according to some probability. Which I'm gonna call here Pi TSI. And that's defined down. Yeah, right. So that's basically if I, there's an underlying assumption of a press on contact process and homogeneous mixing. And what you end up with is an infection probability that looks like this. It's one minus e to the minus. And then that transmissibility. Or infectivity that I had on the previous slide, right?
So beta. The infection rate times the number of infectious individuals divided through by. The population size where actually that's optional. Okay, and then similarly. The number of new removals well that's gonna be binomial as well the maximum number I can have is the current is the number currently infectious. Right. Theoretically, all of them could enter the removal. State in one at one time point. And then we have a probability. Determining that, which is just gonna be one minus e to the minus gamma. So. Obviously your infectious period doesn't. Depend on who else is infectious or how many other individuals are infectious. But your risk of getting infection, becoming infectious does. Rob, I have a question. I mean, because I think it's an important question. Can you explain more? This is to cast it compartments. So I'm guessing I answered that on this slide. Was there something more?
Lines. So, Houdini, please. You can type again if you. If you have for the doubt about about the interpretation of this compartments. Okay, but I will say that it has been answered. Okay, go ahead. Okay. Alright. And then if you simulate from a model like that. The number of susceptible. Infectious, removed, changes over time. The number of susceptible will go down. The number of removed will go up.
Generally the number of infectious goes up. And then down again, right? And if you want to go through this matrix and check that it fits those, difference equations. We can, you can do that afterwards, but you know, it's a fairly simple calculation. In fact, you can do this in Excel if you want and run these things and people do do that. Not me. Okay, so graphically what does this look like? So here I've got a population size of 10,000.
I've set my transmission rate to be point 8. My removal rate be point 2. So my infectious period here will be one over point 2, which is 5. Okay and it's generally this red curve that we're interested in, the number infectious or sometimes we look at the number of new infections, right? If that tends to go up. And then as. My number of susceptible goes down. You reach an inflection point, right? There are no there are fewer susceptible to be infected. So this curve heads back down and tell.
Pretty much everybody's been infected, right? This is stochastic. So the epidemic can die out early. So not necessary. It's not necessary that everybody gets infected. And actually you can see. That the number of infections which goes to 0 is lower. Than the number of susceptible. So there are still some susceptible. at the end of this simulation here. Okay. And, similarly the Good, similarly, it's the inverse, right? But there are a number of removals goes up.
Over time and tends to go to end. Depending on when the epidemic dies out. Okay, but there is the So he's a graph of. 20 epidemics. So you can see I've actually changed the infectious period here of halved it. So this is peaking much lower previously it was peaking around just over 4,000. 4,500.
These peak generally around 400. Okay, but there's a fair amount of variability there. And you can actually see there's at least one curve down here where the epidemic died out through random chance at the beginning and never got going. Okay, so there's a probability of. Not quite. But low numbers of infections as well. Alright, since. I can see that there's no questions there. I'm just gonna talk briefly about inference for this model.
So the likelihood for this model is actually very simple. In fact, let's go back to this stochastic slide because everything really interesting going on. Is occurring here. Right. I've got a bunch of new infections at each time point. So time series of new infections. I've got a bunch of Remove new removals at each time point. So time series of those. And they follow, So I can just write down the binomial mass functions.
And this is actually where we come. How did that happen? This is the log likelihood so it's all on the log scale. But if you look at that, you'll see that's just by now. Mass functions on the log scale. So if you know the number of infections at each time point or new infections. And you know the number of new removals at each time point. You plug that in to this likelihood. And you can maximize that quite easily to do maximum likelihood influence. Okay.
Using the optimum command in our or however you like. And in fact, there are packages around our packages around to do that as well. Okay, so they actually I will answer this question as well just before we go on. So the deterministic model. Hey. Or the deterministic equivalent of this model. Would be a series of ordinary differential equations. Okay, which will look very similar. You've got the susceptibles being depleted by Right. That, give, give, in here.
But you do this in ordinary differential equation. So the deterministic model. When you run that you get the same output each time and when I say deterministic it's generally a continuous time. Version of that model as well. Cause it's an ordinary differential equations. That's the sort of standard and the model that most people mean when they refer to as an losing and actually the deterministic model is great if you're just interested in the mean behavior.
As you saw from this. I think the stochasticity that you get with these models. Is much more realistic of what we see in real life, right? Epidemics can die out. I mean, and, you know, just through random, random is a dangerous word, right? But unobserved, all random things going on in the population. You can get quite different outcomes. So I think most people agree that adding some stochasticity to these models.
Is a plus and certainly from a statistical point of view if you want to capture uncertainty you have to do that right. Okay, the vaccination. Question, I will come back to you later because that fits in better with the extensions. Done. Please Alex remind me if I forget to address that. Okay. Okay, so like I said, we can do maximum likelihood inference. We tend not to. Right. We tend in this field to use. Bayesian models or work in the Bayesian framework. There are a number of reasons for this.
The first one there. Influence based on the posterior. Is highly interpretable. Is perhaps not the most important one from, from a. A disease model is point of view. That is very nice, right? The fact that your posterior is probability distribution and you don't have to think about repeated sampling. What does repeated sampling mean anyway with an epidemic which only occurs once, right? Is very nice. Right. But it's actually the second and third points here that I think. A more important from a practical. Point of view. Right. So one of the things is that I've said If you've observed your number of new infections and a number of new removals at each time point. We can do maximum like good inference here very simply. Well, that actually is quite a big assumption. And generally our epidemic data are incomplete in some way.
Often due to censoring, right? I do not normally observe when someone gets infected. I might observe when there's a lab diagnosis or when symptoms occur. But that happens after infection and I may well not know how long after, right? And it can vary a lot between people. And COVID was very highly variable disease. So because of that we often want to impute the data. Or if you jointly estimate.
The missing data and the model parameters, which is conceptually straightforward to do in the Bayesian framework because the data and the parameters are both. Random variables or realizations of random variables. Okay, that's called data augmentation. And essentially, as I say, It means jointly estimating the data or the distribution, the posterior distribution of the missing data. And the model parameters. Okay. It's harder to do in the maximum. Frame you could do it the name, but maximizing those. Hi, dimensional, likelihoods can be difficult. Okay. And then the third one. And this is tied to the second point here is the Bayesian. Framework obviously builds on prior information. You start with your prior, you update that information with your likelihood. Well in our case we often have prior information because other people have done studies.
As I said before, the parameters tend to be interpretable on their own. So you may have piecemeal studies. It's often quite easy to sit down with an expert and say, Give me an 90 or 95% probability interval. For the infectious period or the main infectious period. What do you think is going to be the case? And the truth is if you're doing this where you're essentially trying to model. The data or part of the data as well as the parameters.
We often rely on prior knowledge to put us in an area of the parameter space. Or if you like, cut off unrealistic. Areas of the parameter space and it, identifiability of the models. Having said all of that, I'm not gonna do this today. We're gonna assume that we've seen The, we know the number infectious at each time point and the number removed. But just to bear in mind that we often do want to be doing that.
Alright, so in our case, there's our likelihood again. If we're doing it in a Bayesian framework. We put prize on our parameters. Our 2 parameters, beta and gamma are both positive, that rate parameters, right? So typically we'd use a gamma prior, you could use a half normal or uniform. half T, something like that. And also often We will put the prior on the inverse of the gamma. The mean infectious period.
Partly because it's easier to elicit. Prior information that way, partly because it's just easier to interpret, right? From our own point of view. But you can do it either way. Okay. No. The way we've been doing this recently in my group. Is using what's called nimble So, in our package, well, essentially a language. For fitting statistical models. In the Bayesian framework, using Markov chain, Alright. It has a few advanced, so it's built upon these older languages. So bugs.
And jags and you can do everything today. Everything I'm talking about today you can do using bugs or jacks. The nimb is built on that, which means there's a lot of material out there. If you're learning nimble you can get code for all different sorts of modeling situations But the key thing here is one of the key things is that Nimble, compiles.
The, MCMC in C plus plus, which means you end up with pretty fast, MCMC algorithms, which can be a an issue for complex models or a lot of data augmentation. And then the other thing I can't really get in today. Into today is that Nimble also allows us a lot of flexibility. So basically you can go into nimble and change the MCMC proposals samplers that are being used for different parameters to make things more efficient.
That becomes important when we do. Day to augmentation. Okay. Now I actually, I don't have time really to go through all the Nimble code, but I have a Markdown file. So if I can close. No, how to use my own computer. There we go. If I go to my web page. So my web the link from my web page is. Is at the beginning of the slides and on the final side as well. If you just search for Rob De and you might have trouble finding this web page because it's a new one.
I had a university account of Calgary one. And then, well, they got rid of the web hosting and so I've got a new GitHub based page. But if you, as you can see, I've got a picture of me there that when I was quite a bit younger. If you go down to the bottom of the, opening page, you'll see that there's a Oh, nimble code, but, for today's talk. The mark down file is there if I click on the PDF That would download and I'll just briefly show you what's in this. So.
I'm gonna go through this very quickly. We've got a bit of code here which basically defines the model. If you take a look at this, this is setting the initial conditions. And then this has got the removal, probability. The infection probability this one changes over time. This one doesn't. The. New infections, the removal infection, so that's the key part of the model. And then also what this is as well, the updating of those things. So this is the difference equations and then my information about the prize. And then we do things using this model. Right? So on the next couple of pages, we do some simulation work. So you can see similar things to what, what I showed you in those slides. And then here. Well, I've got slides on this in the talk, but this is basically the code for simulating a data set.
Specifying my prior. And then using MCMC. To to fit that model. Now, apologies that that's so quick. I don't really have time to talk about it now. Please, feel free to have a look at that afterwards. And if you have questions, let me know. Oh, I should have said. So. Caitlin Ward, who's now Minnesota, but was a postdoc of Alex and mine. She actually coded most of this up. So really that was all for names should be reversed. I mean, I did make some changes, but Kaitlin did most of the work.
Learning how to code these things up in Nimble. Okay, so she needs to. Big dose of credit there. Okay. So. There's all the code. In the background, we'll forget about that for now. What I've done here is simulated a data set. So with the, transmission rate of point 6. And the removal rate of point 2, so my infectious period once again is 5 days. And here what I've got is the number of new cases.
Is called this incidence number of new infections. Should I buy this curve? And the number of new removals. Which is delayed a little bit. And then that data set. Which is essentially 2 times series, right? If I want to analyze that, I need to put a prior on it. Or price on my parameters. Hey, what I've done is I've used. An exponential prior. So a gamma prior with rate and shape equal to one for beta.
Okay, so if you remember my true value of beta was point 6, so this is a pretty uninformative prior. On that beta parameter on the gamma, I can do this analysis with a non-informative prior on gamma as well, but what I've chosen to do is pick a prior. The essentially has sort of ties to information we might have in real life. So I've picked this prior. So that essentially that's about one over 6. How about? One over 4.
So about 90%. Of my prior mass. Give me a mean infectious period between 6 days and 4 days. Okay, so that's the sort of information you get. And if you want, there are packages that will elicit these prior, you know, given quantiles like that. So like say this is a reasonably informed prior. But not that informative actually if you change if you simulate data we have 4 day infectious period and a 6 day infectious period. You actually tend to get quite looking. Different looking epidemic.
Good. I'm supposed to be leaving this to you, Alex. I'll come back to these questions in a minute. Okay, let just let me know why I'm here to help you. Yeah. I know. This, this is my control. Okay. So if I run my MCMC, what do I get at the end? For that data set. Well, I get my MCMC trace plots. For those of you who aren't familiar with MCMC, what I'm essentially looking for is a stationary curves, so, stationary plots.
Cause what MCMC does is it sets off a Markov chain which when it reaches stationarity is exploring the posterior. So if I throw away some of this curve. It's not really, is it? It's chain, that's the way I'm after, throw away some of this chain. I can treat the rest of the chain as if it's a sample from the posterior. And then that's what I've done down here. I threw away 1,000 samples. From those chains so I get my marginal posterior for beta. Remember the true value was point 6 here and I get my marginal posterior for gamma. My true value was point 2. Okay. Alright, I should say that these trace, beautiful trace plots. That's really because we have simulated data. It tends to be a little bit harder to reach stationerity with real data when you've got, you know, problems with. And then I can do things like, you know, just find the posterior mean. So it's point 6.
To 2 decimal places point 6 one for beta. Point 1 9 1.2 0 for Gamma so very close to the true values and I can get my credible intervals. So here I've just got percentile intervals. The 2.5 and 97 point fifth percentiles of my posterior which are obviously capturing the true values. Okay. Alright. So that's my brief overview on how to fit that sort of model to data.
As I say, you really will need to dive into the nimble a bit more to understand what I've done, but it is easy to just code up the likelihood and maximize it in our. Okay, so a couple of questions. Can models like these be used to moral situations? Where infection is considered a social influence. Okay. I don't understand that question. Okay. So let me just suggest, John that you clarify the question, please, and then Rob will address it again.
Yeah, that may be different language in different fields, but I don't quite follow that. And that's for books. Well, I'll come on to that. In a few minutes. Okay. Alright, so one sort of aside, I'll go through quite quickly. I want to about this idea of a basic reproduction number. Or not. This is essentially a a statistic or. A quantity that's used a lot in infectious disease modeling. It's known as, And what it represents is the expected number of infections.
The result directly. So directly is important. From a single infection. In an otherwise wholly susceptible population. Right, so it's conceptually we're saying here's my population. One individual gets infected somehow. How many individuals on average did they directly infect. Right. And it's a useful metric because neither the transmission rate or the infectious period on their own.
Really tell you about the strength of the epidemic. A very large transmission rate, but tiny infectious period might not give you a very strong epidemic. Now it turns out if you go through the math. It's very simple to calculate in an SIr model. It's just the transmission rate divided by the removal rate. Which is what the transmission rate. Multiplied by the infectious period, which conceptually sounds completely correct, right? Well, it is completely correct. The transmission rate determines how often you are infecting the infectious period determines how long you're infecting for. And it captures if you like this strength of the epidemic. It has this nice threshold behavior in relation to all or equals one. And so it turns out that if, is less than one. The epidemic. I'm sorry, if I know it's greater than one, start there.
That means on average you're infecting more than one individual. The epidemic tends to take off and infect the entire population. Okay, if it's close to one, it could die out for random chance, but it tends to go through the whole population. Where is he? Where is less than one? The epidemic will tend to die out. And that's one of the reasons it's of interest. We can really need to, oh, well, it's here now, right?
So here's a couple of examples. So if I had a situation where B 3 was one, gamma, point 2. So, II know, equals 5. I get a curve here that looks like this. I've done this on the proportions scale over here. So that's the proportion of the population susceptible, infected or removed. If I have my transmission rate. But keep the, the removal rate the same. My own all goes down by half as well. 2.5. You can see what happens is I end up with a much slower epidemic.
And you'll remember from COVID at the beginning. There was a lot of talk of bringing down the our number. So that we had more time. The epidemic was slower we had more time to put in place you know emergency hospitals and and public health measures and that sort of thing. But often what we're trying to do is bring that, right under one, one so that we can. Actually, get rid of our, right, so that it dies out. Okay. Okay, let's
Oh, okay. So the question about the social influence question. Is I would say yes. But I don't know enough about the field. Like, so people do use these sorts of models because the more, Yeah, the more you see a social media meme or the more people who see a social media name. The more there are to pass that on. So the general numbers of people who see a social media, or do something like the ice packet challenge. Could follow that. That sort of.
The similar sorts of dynamics. Thanks for clarifying that, John. Okay, how are we doing? I'm going a little bit slow, but I do want to talk about some of these extensions. Okay. I'm gonna go over these quickly because really I've just introduced you to the classic. Disease model. And there are lots of different possibilities. Right. So one of the possibility is to change that compartmental framework or the number and types of states.
Right. So, the I said before. And then corrected myself that the SIr was the the simplest non-trivial model. Probably the simplest non-trivial model is the Si model. So in the Si model. You essentially allow for infection, but then assume everybody stays infectious. For the rest of the time period. You're observing. Okay. That can be useful. I mean, some diseases people don't recover. If you're looking over a fairly short time period and then modeling something with an infectious period that's long. HIV is the obvious thing that springs to mind. An Si model might make more sense than an Okay. The other thing that's very common. Is this SEIR model that I will talk a bit a little bit more. On the next couple of slides. That basically allows for a latent period where after getting the disease your body is reproducing the virus, the bacteria, the pathogen.
There's a time at which you don't have enough of that pathogen to infect other individuals. So you go through this period exposed period to be referred to it where you're infected but not yet infectious. Okay, that's in a lot of diseases, that's a very important thing to include. And then another sort of class of these things. Models that allow for re-infection. So SISI RSSE IR.
After your Oh state here does mean Recovery with immunity. But that immunity dies off after some period and so you go back to being susceptible. Alright, so what you'd essentially have is if you remember I had that initial. Slow diagram with my rates. There would be Another right, let's call it lambda, which individuals go back to being susceptible, for example. Okay, and you can build up the model. Quite simply in that way to make these things quite complex.

Ask anything
We've read this whole study set, so questions about it get the best answers.