QuantEcon / lecture-source-jl

Source files for "Lectures in Quantitative Economics" -- Julia version
https://julia.quantecon.org
BSD 3-Clause "New" or "Revised" License
131 stars 53 forks source link

Thoughts on covid and SciML lecture outline #859

Open jlperla opened 4 years ago

jlperla commented 4 years ago

@jstac @thomassargent30 @ChrisRackauckas

Starting with the python version as a reference: https://python.quantecon.org/sir_model.html

My thought is that there could be two lectures here:

Here are some rough thoughts, none of which I am especially attached to. But I think a good goal is that everything in the "first lecture" are things where the code is probably already complete somewhere so it could be done quickly.

For the first lecture:

For the second lecture:

thomassargent30 commented 4 years ago

Jesse --

I like what you propose both in terms of teaching about tools and applying them to a nifty class of models. If some simple "uncertainty quantification" could be done in the spirit of "uncertainty outside (but NOT inside) models" it could be a nice introduction to those techniques as well as a way of setting the stage for some models with uncertainty inside the models including from agents inside the models.

ChrisRackauckas commented 4 years ago

Hey,

A good resource to start from as well can be the updated epirecipes https://github.com/epirecipes/sir-julia and the older version http://epirecip.es/epicookbook/chapters/sir/julia . The those show all of the models, but indeed it would be nice to use this space as a larger explanation of them. This tutorial for example (https://github.com/epirecipes/sir-julia/blob/master/markdown/rn_mtk/rn_mtk.md) describes transforming a jump equation (Levy process) into SDE and ODE approximations, but doesn't explain what the equations it's transforming to are like and why those are the equations. So maybe taking that as a starting point and expanding from there might be a good start. And https://docs.sciml.ai/latest/tutorials/discrete_stochastic_example/ is a good reference in the DiffEq documentation on how to define numerical problems related to these equation types and mixtures.

From Markov Models to ODEs and SDEs: the Wide Range of Epidemic Model Approximations

With those in mind, I think maybe even reversing the normal flow could be an interesting way to introduce these models in a deep way:

This form would require a bit of probability, but wouldn't require anything crazy like measure theory to explain, so it might serve as a very cool non-rigorous but still mathematically-informed version for understanding how these discrete Markov models relate to the continuous approximations. Also, the fact that the continuous models are inherently worse approximations for small approximations, like when you have only 1 infected person, becomes extremely clear from this presentation, since by design all of the show that the continuous model is a population->infinity limit. The tooling can then be weaved into this story as how you solve the models, but placing the models first probably would be more helpful to people just entering the domain, where the tools are mostly a "okay now solve it" button.

Inverse Problems, Control, and Scientific Machine Learning

I'd clump this all together as the same general parameter estimation concept.

We could go into scientific machine learning and estimating incorrect model forms by looking at the problem one of the students from my SciML course did (https://covid19ml.org/), which was that we don't actually know how exposure works, it's very nonlinear, and the linear assumption of making it a rate constant is quite bad, so let's make that part of the model be an unknown function of quarantine and such, and try to fit a neural network to understand how different measures of quarentine give rise to a more complex model. This starts requiring per-county data for the estimation though, which might be muddling the story and so it might be (sadly) better to cut before this.

jstac commented 4 years ago

Hi all, I don't have much to add but I'm very interested. I like the exposition that @ChrisRackauckas suggests -- continuous time MC to ODE approximation. That sounds like a good starting point, and a form of exposition where simulation would be helpful.

I looked this stuff up before getting involved with that first SIR lecture and found it fun and interesting. If someone else kicks off the writing process along these lines I'll try to contribute.

jlperla commented 4 years ago

I like it. My only concern is that since economists are so used to deterministic ODEs using large number approximations that building it up from the finite-agent approximations scratch might be too much in the same lecture as looking at aggregate stochastic shocks.

Perhaps having splitting out a shorter continuous-time markov chain lecture makes sense? We could take out https://julia.quantecon.org/tools_and_techniques/numerical_linear_algebra.html#Continuous-Time-Markov-Chains-%28CTMC%29 clean it up, and then go through the connection of markov chains and the look at the gillespie and langevin elements. I have a feel that there may be useful tools for dealing with search models where the number of agents is large enough for a continuum approximation, but not too small for a deterministic ODE to work.

I am trying to see if I can improve my childcare situation by the beginning of June so hopefully I can think more soon.

jstac commented 4 years ago

+1 on splitting out a shorter continuous time MC lecture. Topics to cover

jlperla commented 4 years ago

Hi all. It looks like I will have some childcare help in June, so maybe we can sketch some stuff out late next week? I think a lot of the markov chains+covid sde stuff could come together quickly. Then the uncertainty quantification/sciml material can be built on at the appropriate speed, since much of it would be new.

jlperla commented 4 years ago

@jstac @thomassargent30 Sorry the the delay. @ChrisRackauckas and I are going to power through the basic covid lecture at the beginning of next week.

I think our intention was to:

For this, I think a few of my questions are:

jstac commented 4 years ago

Please feel free to cut out the sections you mentioned. Or the lecture could be expanded into two.

Aggregate shocks to the transmission rate would make for interesting dynamics but it's not so obvious what would drive them. Events like the recent street protests?

jstac commented 4 years ago

Here's one potentially interesting idea: "Flattening the curve" is producing more like damped oscillations in some places (Australia included). New cases tend to zero and then spike up again.

What's driving this? I guess it's a learning process. The transmission rate is determined by govt policy and social behavior. Both base their choices on some kind of reinforcement learning mechanism. If new cases are low, behavior relaxes. Case then increase and behavior tightens up again.

Learning could be modeled in a simple way (backward looking weighted average) or a sophisticated way (machine learning).

jlperla commented 4 years ago

A thought on the superset of equations for this, which might nest the examples we are interested in. image

Here I have put left things unnormalized, which will be useful if we have aggregate shocks to people entering/exiting the particular geography and counting the cumulative deaths for policy uncertainty.

The key here for the notation is:

With these, the "policy" related choices are:

Finally, the aggregate stochastic elements are

ChrisRackauckas commented 4 years ago

An additive noise process like that will make it not have guaranteed positivity. We should probably make the noise multiplicative/proportional, which should be an easy way to impose that property.

jlperla commented 4 years ago

We should probably make the noise multiplicative/proportional, which should be an easy way to impose that property.

So you mean like d s(t) = beta(t) s(t) i(t) + s(t) zeta d W(t) ? If so, that is perfect and clean. Probably more realistic as well. I tried to work with logged s(t), etc. to keep thing positive, but it got uncessarily ugly which was why I had given up.

OK, I will take another shot at the ODEs this morning for discussion.

@ChrisRackauckas Are you aware of any simple extensions of the SIR that have testing and/or asymptomatic carriers with them?

ChrisRackauckas commented 4 years ago

So you mean like d s(t) = beta(t) s(t) i(t) + s(t) zeta d W(t) ?

Yup that's it.

Probably more realistic as well. I tried to work with logged s(t), etc. to keep thing positive, but it got uncessarily ugly which was why I had given up.

There's technically an Ito correction term if you do it with an SDE, and that's... definitely not something for an introduction to the model type haha.

Are you aware of any simple extensions of the SIR that have testing and/or asymptomatic carriers with them?

I don't, but maybe @sdwfrost might be able to help guide us towards the right model.

sdwfrost commented 4 years ago

There's lots of models out there! This one includes asymptomatic and hospitalization:

https://github.com/covid-projections/covid-data-model/blob/master/pyseir/models/seir_model.py

Most of the models that consider asymptomatic, testing etc. are also age structured, which adds another layer of complexity. You can take a look at an incomplete list of models with their characteristics here

jlperla commented 4 years ago

@sdwfrost Thanks so much. These are outstanding, and that is exactly what we were looking for to compare. We will take a look to see if we can find a parsimonious version to demonstrate some of the tools we have in mind for economists.