Corona data analysis, automising .exe with python and statistical rethinking

Did a couple of fun sciencey things. Probably can go back to work in March. In the meantime, learn, discover and create more :o)

Corona data analysis

For a previous post I had a look at the underlying function driving the corona spread. I got an excellent fit to a quadratic function:


corona_spread.jpg

The definition of being infected has been redefined in the meantime so it certainly doesn't match the current data. But there is still the relevant question of why the newly infected cases follows a quadratic polynomial. I have a nice heuristic argument for this.

Heuristics! So I assume (which is a big assumption) that the actual number of people with the virus is much greater than the confirmed cases. This means that the graph above gives an estimate of how many people can be confirmed to have the virus, which requires medical test. View medical test as a resource which needs to be sent to a location. Suppose an idealized setting where resources are spread out uniform, the location to which they need to be send is a point and travel speed is a constant. Then, the resources at that point will be a quadratic function in time since the area of a circle is quadratic with respect to the radius.

And a note. Heuristic/Qualitative reasons should always be viewed critically because they never come with error bounds, likelihood functions etc. In the real world everything works with quantitative stuff so never fully trust when somebody cannot provide a quantative reason backed by real data. Also note that people who think that long term extrapolation is useful without understanding the underlying dynamics are stupid. Only do it for fun :P. So here is how long it will take before everybody gets the virus (based on 17 data points)


corona_spread_extinction.jpg

lol 25 years :P

Automising exe with python

In China I use a VPN. Sometimes there is no connection from a VPN location so then you have to switch location. This doesn't go automatic :( In addition, when the VPN cannot connect it will timeout after a couple of minutes. :( Anyway, Python to rescue because there is this lovely module called pywinauto which can automise .exe stuff on your windows machine. It runs on python 3.3 to 3.7.4 for later version it doesn't seem to work . Also, when installing keep in mind that you need to run in the same bits as in the exe you want to automise e.g. run 32-bit python for a 32 program (if you are using conda you can just type set CONDA_FORCE_32BIT=1 to get this done)

Statistical rethinking

Statistical rethinking is a book by Richard McElreath. It mainly covers Bayesian inference using R which is a statistical software/language. It has a pretty hands on approach. So it comes with a library with lots of data and tools you can use to master Bayesian inference. The idea is pretty much to combine data with a model to arrive at something which is better than both.

The book has a bit too many words for me. It is really afraid of showing the reader formulas so I guess that is good for some peeps. R is pretty easy to use although I find it a bit confusing at times. Internal functions are very flexible in the sense that they accept inputs which would certainly raise an error in other programs. For example, for certain statistical functions for which mathematically the same length vectors are needed R will accept vectors of different length and just repeat the last element of the shorter vector to match the length of the longer vector D:

For statistical stuff R is way more convenient than anything else I know. Here is a beautiful normal distribution with just a short line of code curve( dnorm( x , 420 , 42 ) , from=320 , to=520 ) :D


image.png

Time for some modelling exercises from statistical rethinking :o)

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center