2SD | ! 2SD

For those of my (Swedish) readers, who from the perhaps somewhat cryptic headline of this post got the impression that this will be something about the ( in politically correct circles – which I definitely don’t belong to!)  utterly taboo-to-mention political party Sverigedemokraterna :

Sorry to make you disappointed, this is going to be about much more mundane stuff: programming with Python, and some statistics. SD in this context is a concept from statistics, Standard Deviation, a metric on the variablility of a data set.  However, in the current political discussion climate of Sweden, even facts and figures can be accused of being offending, as is the case after the Swedish daily DN published an add for a book that supposedly reveals the real costs and benefits of immigration, facts and figures based on datasets from the government bureau for statistics….

[It wouldn’t surprise me though if I’m now going to be seen as ‘racist’ and ‘xenophobic’, simply because I’ve dared to even mention that ‘evil’ political party, which according to mainstream Swedish PC establishment should be competely ignored, ideally banned.  Despite the fact that  Sverigedemokraterna got almost 12 % of the voters in the November polls… That’s the sorry state of Swedish politics nowadays: unless you are fully with the PC-crowd, you must be evil and have no say… ]

Anyways, this was supposed to be about Python and stats, not politics…

So, continuing my exploration of Python and its scientificmath and plotting libraries, I did some further experiments on the theme from the previous post, that of two teams competing with each other, simulated by Monte Carlo methods.

What I wanted to explore this time was the features of the math and plotting libraries, how to draw not only the histograms of team performances from the previous post, but including some of the statistical data drawn from those numbers, in particular the mean and standard deviation.

Again, I’m impressed by Python: these types of graphs with vertical limiters (in this case for the mean and standard deviations) are far from simple to do in excel, but in Python, with matplotlib, it took me just a couple of minutes to figure out how to do them.  Illustrations below.


The yellow vertical bar illustrates the mean, and the red ones represent the first and second standard deviations.


About swdevperestroika

High tech industry veteran, avid hacker reluctantly transformed to mgmt consultant.
This entry was posted in development, Math and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s