Remove all objects from workspace.

r remove (list = objects() ) Load add-on packages - deSolve - contains lsoda function - differential equation solver.

library (deSolve)
## 
## Attaching package: 'deSolve'
## 
## The following object is masked from 'package:graphics':
## 
##     matplot

Function to compute derivatives of the differential equations.

tivivni_model = function (current_timepoint, state_values, parameters)
{
  # create state variables (local variables)
  T = state_values [1]        # target cell
  I = state_values [2]        # infected cell
  VI = state_values [3]       # infectious virus 
  VNI = state_values [4]      # noninfectious virus 
  
  
  with ( 
    as.list (parameters),     # variable names within parameters can be used 
         {
           # compute derivatives
           dT = lambda - (d * T) - ((1-ERT) * (k * VI * T))
           dI = ((1-ERT) * (k * VI * T)) - (delta * I) 
           dVI = ((1-EPI) * (p * I)) - (c * VI)
           dVNI = (EPI * p * I) - (c * VNI)
           
           
           # combine results
           results = c (dT, dI, dVI, dVNI)
           list (results)
         }
    )
}

Parameters

lambda = 10 #reproduction rate of uninfected cells per cubic millimeter per day
d = 0.01 #death rate of unifected cells per day
k = 0.0000457 #HIV infection rate per cubic millimeter per copies per day
delta = 0.4 #death rate of infected cells per day
p = 38 #virus production rate per copies per cell per day
c = 2.4 # virus clearence rate per day
ERT = 0.4 #reverse transcriptase inhibitor efficacy with treatment
EPI = 0.4 #protease inhibitor efficacy with treatment

Disease dynamics parameters.

parameter_list = c (lambda, d, k, delta, p, c, ERT, EPI)

Initial values for sub-populations.

W = 0           #noninfectious virus
X = 1000        # target cells
Y = 0           # infected cells
Z = .01       # infectious virus 

Compute total cell and viral counts.

N = W + X + Y + Z

Initial state values for the differential equations.

initial_values = c (VNI = W, T = X, I = Y, VI = Z)

Output timepoints.

timepoints = seq (0, 100, by=1)

Simulate the TIV treatment model.

output = lsoda (initial_values, timepoints, tivivni_model, parameter_list)

Plot dynamics of target cells.

plot (T ~ time, data = output, type='b', col = 'blue') 

Plot dynamics of infected cells.

plot (I ~ time, data = output, type='b', col = 'red')   

Plot dynamics of infectious virus.

plot (VI ~ time, data = output, type='b', col = 'purple')  

Plot dynamics of noninfectious virus.

plot (VNI ~ time, data = output, type='b', col = 'orange')  

Plot dynamics of target cells, infected cells, infectious virus, and noninfectious virus in the same plot.

# target cells over time
plot (T ~ time, data = output, type='b', ylim = c(0,2000), col = 'blue', ylab = 'T, I, VI, VNI', main = 'Viral and Immune System Dynamics of HIV Using TIV Model and Treatment Implementation') 
text("T", col = 'blue')
## Warning in xy.coords(x, y, recycle = TRUE): NAs introduced by coercion
# remain on same frame
par (new = TRUE)    

# infected cells over time
plot (I ~ time, data = output, type='b', ylim = c(0,2000), col = 'red', ylab = '', axes = FALSE) 
text("I", col = 'red')
## Warning in xy.coords(x, y, recycle = TRUE): NAs introduced by coercion
# remain on same frame
par (new = TRUE)  

# infectious virus over time
plot (VI ~ time, data = output, type='b', ylim = c(0,2000), col = 'purple', ylab = '', axes = FALSE)
text("VI", col = 'purple')
## Warning in xy.coords(x, y, recycle = TRUE): NAs introduced by coercion
# remain on same frame
par (new = TRUE)  

# noninfectious virus over time
plot (VNI ~ time, data = output, type='b', ylim = c(0,2000), col = 'orange', ylab = '', axes = FALSE)
text("VNI", col = 'orange')
## Warning in xy.coords(x, y, recycle = TRUE): NAs introduced by coercion

This graph represents a simualtion of the viral and immune system dynamics of HIV with a treatment intervention. At the start of the simulation, the target cell count is 1000, infectious virus (viral load) is 0.1, noninfetious viral load is 0, and no cells have been infected. As we get to about day 10, the infectious viral load, the number of infected cells, and number of target cells have all decreased. The reverse transcriptase inhibitors block the viral RNA from transcribing into DNA inside the host cell. Also, protease inhibitors prevent new infectious particles from forming by blocking the enzyme protease. The result is an uninfected host cell but the formation of noninfectious viral bodies (virions). As time progresses and treatment is continued, the virion levels grow but they remain noninfectious.

Comaprison

In the TIV model without treatment, they viral load and number of infected cells increase over time while the number of target cells decrease. All levels eventually parallel each other but never reach 0 completley. This process take a much longer time. When treatment is implemented, the number of infected cells and the viral load reach near 0 far quicker. Target cells become infected with virus but do not become infectious cells. Treatment proves to have a far better outcome when decreasing viral loads and protecting the host from HIV infections as compared to no treatment. Reduction in all levels is seen much faster with treatment as well.