## Day #230: Coronavirus modeling – Part 3

Well today will need to be short. I broke my model… on purpose, but it still broke. That means I need to go back and check my equations, make sure my assumptions are correct, then figure out why the heck I’m getting the results I’m getting. I have a good idea about what the problem is, I’m just not sure how I want to try to fix it.

In the model I have a bunch of variables, some I can solve for, others are not quite as clear cut. For example I need to have a good idea (or some way to solve for) the latency period between infection (asymptomatic) to exposed (symptomaic). This is not only a function of a variable that changes from person to person, but is also a function of the recovery rate.

For every time step t (days, weeks, hours, months, whatever you want) we also have some people going from infected to recovered (or in this model dead as well). That is a function death rate as well as recovery rate, but we don’t need to know that to determine how many people are leaving the infected group since we only care about what is in the infected group right now. So we have stuff going in and stuff coming out, but we need to tune those parameters according to the data we collected.

For some reason, I’m ending up with a much steeper prediction, it’s converging on the correct rate for a time t, but after I step the model forward, it shoots off to some ungodly number that is either very not correct, or very bad for us. Since I have some experience with this, I can tell you the number is not correct, so no need to panic. Instead I need to go back and make sure that I programed my system correctly and rederive my rate parameters to (hopefully) converge on a better solution.

When we do this, we converge on a local minimum or maximum in the solution space. That just means that there are a lot of ways to solve an equation with multiple variables and the function I am using looks for the best to solve it depending on where I put my first guess. This is a problem because it doesn’t guarantee that I will hit a true maximum or minimum, just a local one. My assumption right now is that I initialized my function with a guess close to a local maximum/minimum that it is converging on, but is not the best solution for this set of equations.

Now I need to spend a good amount of time trying to pick a different starting point for my search, but I also need to make sure that there are no errors in my code because if there are, then that could be why I’m having this problem. The issue is that right now I’m up to about 500 lines of code give or take, my last model was under 50. So yeah, busy day since I need time to get my slides together and my video. UGHHHH!!! Why does modeling have to be so hard?!

## But enough about us, what about you?