Sunday, October 18, 2020

Monitoring CA Covid-19 Data

 

  One can download California Covid-19 statistics which come in a Comma Separated Value (CSV) file format that one can open with a spreadsheet program or app and save.



To get daily data for the entire state one can use the SUMIF function. The F column contains the dates.



One can then plot the daily data.




The last date plotted is 10/15/2020. Note there doesn't appear to be any evidence of a "second wave" yet contrary to media reports.


Friday, October 9, 2020

A Closer Look at US Population Growth


  Since undergoing open heart surgery last month I've been trying to analyze the US census data in hopes of being able to make a better prediction of future growth. If we assume the rate of change in the number of people, X, is a linear function of X and integrate we find X is a simple exponential function of the time.  


Separating factors involving the variable X from constant factors we can simplify the function that we need to fit.


If one tries to fit blocks of five census population observations one finds the exponential rate of growth is not constant but slowly decreases. 




After 1920 the rate drops to zero for the exponential term. The reason for this is X is replaced by a linear function of time.




So instead of the rate of change of X being a quadratic function of X which involved a carrying capacity K, the census fits suggest the constants for the fits changed with time and the current rate of change in the US population is now a linear function of time. 

Supplemental (Oct 9): The census fits were 3 point fits centered on the year indicated and using the census values +/- 20 years.

Wednesday, September 9, 2020

Single Variable Equations for the SIR Model

 

  One can also derive single variable equations for the SIR Model. We start with a short review of the model.


We can eliminate I from the equation for the rate of change for S as follows.



Note that the first two terms are a logistic function so we might refer to all the terms as a modified logistic function. Note that if S0 is larger than S the logarithm is negative and the last term is positive reducing the infection rate.  The single variable equation for I is more complicated.



SI Pandemic Model and the Logistic Equation

 

  One can produce a very simple model for a pandemic involving just infecteds and susceptibles, the haves and the have nots, with the infection rate being proportional to rate of interaction between individuals with complete mixing. It is almost trivial to show that the changes for the two compartments follow the Logistic Equation.



We might call this the SI Model since there is no removed compartment for those who have recovered and are no longer infectious and those who have died and no longer interact with others.


Tuesday, September 8, 2020

Theory Versus Reality

 

  I tried to do a more accurate version of Lotka's fit of US population growth. The data used came from Appendex A of the US Census publication Measuring America. Since the day of the year that the census was taken on has not been constant I computed the number of days from the beginning of 1790 and divided by 365.25, the number of days in a Julian year and used that as the time scale. The growth appears to be approximately geometric until about 1930 and may have been affected by the Depression, WWII and the Cold War as well as government domestic and immigration policy. 





The second plot shows the deviation from geometric growth. Lotka's measured time with t'=t-t0 with t0 being the time of peak growth which he gave as Apr 1, 1914. The values I got were the following.






The formula for the time of peak rate of change is determined as follows,



The population growth of the US appears to have been slowing down. The last plot of the rate of change in population growth appears to be symmetrical. So if one uses this model to predict the number of future Covid-19 cases of infections one is likely to be off since the coronavirus tends to linger. The SIR model is a better predictor since it can match an asymmetric curve. For an accurate prediction we need both an accurate model and an accurate fit.

Supplemental (Sep 8): If the data points are not evenly spaced the formula that has to be solved to determine A for the 3 point fit is f=α1(A)-α2(A)=0 or,



Supplemental (Sep 10): Lotka's solution for the integral of the logistic equation is exact. dx/x(a+bx) is a standard integral and gives the same solution.

Standard Integrals


Sunday, September 6, 2020

Comparison of 3 point and NLS predictions

 

  A comparison of the 3 point fit, the nonlinear least squares fit (NLS) and historical statistics up to 1960 is shown in the following plot. It's debatable which is the better predictor but the Depression and WWII may have lowered population growth.


Saturday, September 5, 2020

Lotka's 3 point fit

 

  The trick for doing Lotka's 3 point fit is deriving a formula that we can solve for the unknown value of A after the other variables have been eliminated. We start by deriving formulas for B and α involving the X values. 

The expression for α is true for all values of X so we can use two data points to eliminate it resulting in one equation with one unknown.

If the data points used are evenly spaced we can eliminate Δt to get a function whose zero value gives us A. Assuming a value for A we can use Newton's method to compute the corrections dA. The convergence is fairly rapid so only a few iterations are needed to arrive at the value for A.

 One gets less known error if one assumes the fit is exact for 3 data points but that ignores any error that may be associated with these points and if the 3 point fit is used for predictions the risk is that the results will be slightly off.