Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/examples/hiv_model.ipynb
Views: 531
Modeling HIV infection
Modeling and Simulation in Python
Copyright 2021 Allen Downey
License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
During the initial phase of HIV infection, the concentration of the virus in the bloodstream typically increases quickly and then decreases. The most obvious explanation for the decline is an immune response that destroys the virus or controls its replication. However, at least in some patients, the decline occurs even without any detectable immune response.
In 1996 Andrew Phillips proposed another explanation for the decline ("Reduction of HIV Concentration During Acute Infection: Independence from a Specific Immune Response", available from https://people.math.gatech.edu/~weiss/uploads/5/8/6/1/58618765/phillips1996.pdf).
Phillips presents a system of differential equations that models the concentrations of the HIV virus and the CD4 cells it infects. The model does not include an immune response; nevertheless, it demonstrates behavior that is qualitatively similar to what is seen in patients during the first few weeks after infection.
His conclusion is that the observed decline in the concentration of HIV might not be caused by an immune response; it could be due to the dynamic interaction between HIV and the cells it infects.
In this notebook, we'll implement Phillips's model and consider whether it does the work it is meant to do.
The Model
The model has four state variables, R
, L
, E
, and V
. Read the paper to understand what they represent.
Here are the initial conditional we can glean from the paper.
The behavior of the system is controlled by 9 parameters. That might seem like a lot, but they are not entirely free parameters; their values are constrained by measurements and background knowledge (although some are more constrained than others). Here are the values from Table 1.
Note: the parameter (the Greek letter "rho") in the table appears as in the equations. Since it represents a proportion, we'll use .
Here's a System
object with the initial conditions and the duration of the simulation (120 days). Normally we would store the parameters in the System
object, but the code will be less cluttered if we leave them as global variables.
Exercise: Use the equations in the paper to write a slope function that takes a State
object with the current values of R
, L
, E
, and V
, and returns their derivatives in the corresponding order.
Test your slope function with the initial conditions. The results should be approximately
Exercise: Now use run_solve_ivp
to simulate the system of equations.
The next few cells plot the results on the same scale as the figures in the paper.
Exericise: Compare your results to the results in the paper. Are they consistent?
Exercise: What kind of work is this model doing? Do you find the results convincing? What are the strengths of the model? What are the weaknesses?
Exercise: Read this response to Phillips's article and Phillips's response to the response. What do you think of the arguments on both sides. Do you think the model Phillips proposed is sufficient to make his argument, or do you think it leaves out essential features of the real world?