Tuesday, May 11, 2021

Doing Simulated Experiment to Verify a Fit Procedure

  Suppose you want to do an experiment but you're not sure if the results will be as accurate as needed. One can do a simulation first to evaluate the results. The first thing we need is some simulated experimental date. To be more specific let's assume the data will approximate the equation of a parabolic arc with random measurement errors having a normal distribution with mean μ and standard deviation σ.

  We can generate a set of random errors and add them to the computed y values of a given parabola as follows.



  The second column of random numbers are pasted values of the first column and is needed to preserve the data in the spread sheet since the random numbers and the worksheet are recalculated every time the value of a cell is changed.



  We can use Least Squares to find the coefficients of the parabola that gives the best fit to the data. To do so we create a table containing the simulated y values along with the powers of the x values, the fit functions. Putting y on the left makes it easier to do a higher order polynomial fit later on if so desired.



  In order to use the Least Squares formula for the coefficients we evaluate a table corresponding to the normal equations which is linear and easily solved. The calculation of the table can be done in one step.



  A plot shows that the fit is a good one for the data but the coefficients are slightly off. The random errors can bias the fit if they are not uniformly distributed and consequentially the coefficients have some error associated with them. 


Copying and pasting the values of a new set of random numbers allows one to "repeat" the experiment and observe the variations in the coefficients.

Tuesday, December 22, 2020

When was the Jupiter-Saturn Conjunction?

 

  There's been a lot of talk about The Great Conjunction lately but little information on when it occurs. Given ephemeris data from JPL's Horizons on the positions of planets Jupiter and Saturn we can do a simple spreadsheet calculation to find the time. Horizons will output the data for the planet selected in text format and this can be copied and pasted into a spreadsheet. It's easiest to work with the both RA and Decl given in decimal degrees. When pasted into the spreadsheet the data appears in a number of lines. The value of each field, date, hour, RA and Decl, can be extracted from a line using the MID function. For small angles we can approximate the positions with x,y coordinates and determine the approximate angular displacements, Δr. To do a three point parabolic fit we need to determine the coefficients A, B and C, for the quadratic equation from which we can find the time of the conjunction.



The solution for the three coefficients, if the points are equally spaced in time, is fairly simple.



We just need to solve a linear matrix equation and use the coefficients to calculate Δr_min and t_min.



We can now assemble a simple table containing the required data and do the necessary calculations.





Supplemental (Dec 22): Since the coefficients of the matrix in the matrix equation are +/- 1, the solution is fairly straightforward.


Thursday, November 12, 2020

An Interpretation of the dI/dt Eqn

 

  One might wonder why dI/dt is proportional to I squared and not just I. It could be that the number of potentially infected individuals in Q around the infected individuals is proportional to I as well.



If the red circles in the figure above represent a number of infected individuals and the blue circles those around them then as each red circle grows the number of uninfected individuals remaining in the group or clique will decrease as the virus spreads. That might explain the devreasind exponential term. The negative constant term is likely to be a removal rate of infected individuals as in the SIR model. In the SIR model dI/dt equals rS-a. In the QI model rS is replaced by BI times the exponential term and -a by AI. A zero for (1/I)dI/dt may still be a good indicator of having reached a peak for I. The proportionality factor for I in Q might be thought of as a transfer or transport factor.


It seems unlikely that a removal rate is proportional to I squared so replacing the -a in the SIR model by just a constant A may work better conceptually. This might be the modified SIR model we were looking for.


Tuesday, November 10, 2020

Reading CA Covid-19 County Data & Preparing Plots

 

  Reading the CA Covid-19 case data files is initially challenging but is easier than one might think. One starts by collecting information on the number of county entries with the same name.



Next a Directory is created by sorting the data by county name.



To create a plot of the county data one can select a county from the Directory and plot the data from a copied section containing just the county data.




Supplemental (Nov 10): To select another county tap the county selected and the formula bar then tap on some other county in the Directory and the check icon to confirm the change.



Supplemental (Nov 10): For those not familiar with Excel spreadsheets the formula for cell S15 is  

  =MATCH(R15,M15:M74)-1.


Beginning of a Second Wave in SoCal?

 

  Theory can't always be trusted as can be seen in recent CA Covid-19 data.



The current data is starting to deviate from the fitted curve in what appears to be the beginning of a second wave of the coronavirus in Southern California. Here are county data plots for the area.















Is it going to be necessary to lock down Southern California to slow down the coronavirus there?


Sunday, November 8, 2020

Checking Out the QI Model

 

  There was a lot of interest in "curve flattening" but the fits don't appear to show much evidence of any. There does appear to be a little lowering near the peak but could it have been due to the testing labs being overwhelmed by the number of cases and confirmations being delayed?



The best fit of Q/I for λ helped give the best fit for the QI model although the initial values for K and I required for the numerical integration of the dI/dt formula were somewhat unexpected. The observed values of K were used in the calculations.







Again there appears to be lower values around the peak in the Q/I plot. The time is the number of days from 4/1/20 and the initial observed values for K are lower than those required by the model fit. One could ask if this is due a lack of test kits or maybe poor statistics for a lower number of cases?


The formula for Q seems to indicate that the infection rate is proportional to the number of daily new cases and a factor which includes a rate which decreases as the number of known cases increases as well as a negative term similar to the removal rate in the SIR model. The exponential term appears to be an indication of a saturation effect with the number of uninfected individuals around in infected individual decreasing over time.


Friday, November 6, 2020

A Possible Formula for Q

 

  If one calculates and plots Q/I one gets the following curve.



This looks somewhat like an exponential decay function and if we try to fit one we get the following. The value for λ was chosen by eye.





We will have to wait and see if this exponential factor gives a good long term fit. One can think of it as a saturation term that might explain why I peaks when it does. So our observations suggest,