Showing posts with label bayesian analysis. Show all posts
Showing posts with label bayesian analysis. Show all posts

27 November 2010

Game Theory for Noobs

Game theory is not so much about Playstation as it is a science about strategy. The purpose of game theory is to determine the most rational course of action. Rational in this sense means the course of action that results in the highest amount of possible gain, or in the lowest amount of possible loss.

Christina Aguilera Christina Aquilera Hollywood Star
Christina Aguilera. She recently received her own Hollywood star. Not sure why, but it must mean she knows a thing or two about strategy.

John Nash is frequently associated with game theory. His tragic bout of schizophrenia is often abused to ridicule game theorists and to discredit the science of game theory, as is the case in the BBC documentary The Trap. However, John Nash was a fairly latecomer to the field as John von Neumann established the science in collaboration with Oskar Morgenstern with their book, Theory of Games and Economic Behaviour. This book reported a means to quantify the qualitative notions of expected utility, so in a way von Neumann and Morgenstern gave us mathematics for hope just like Bayes gave us the mathematics for faith with Bayesian analysis.

Nash Bridges
Nash Bridges. Not really relevant here.

The Nash equilibrium


Nash's contribution is the Nash equilibrium. Nash equilibrium results when all players involved know the strategies available to themselves and the other players, but no player has anything to gain by switching strategies. This appears superficially similar to the African philosophy of Ubuntu, which is an ethical concept based on the premise that “I am what I am because of who we all are”.

Thus, my strategies are limited by your strategies and your strategies are limited by my strategic choices, but neither of us have anything to gain by changing our current courses of action. If a Nash equilibrium is available, the most rational course of action is to cooperate and not to change your strategy. A Nash equilibrium is however not possible in all kinds of games. In these games, one can maximise gains by not cooperating (that is, by “cheating” or defaulting).

“Seven deadly sins, seven ways to win”


Strangely scientific lyrics from Iron Maiden in Moonchild. Seven of the games in which cheating or defaulting may be beneficial to you and detrimental - fatal, even - to other players as identified in Len Fisher's excellent book Rock, Paper, Scissors are:

  1. The Prisoner's Dilemma

  2. The Tragedy of the Commons

  3. The Free Rider Problem

  4. Chicken

  5. The Volunteer's Dilemma

  6. Battle of the Sexes

  7. Stag Hunt

In the next couple of posts, I shall deal with each of these and elaborate in my usual sombre tone.

19 June 2010

The Demon of Laplace

South African author Joan De La Haye offers Demon Friday. Surprisingly, it's each Friday and it involves a demon from one grimoire or another. She also greets us as 'freaky darlings', similar to Vampira. Top class!

This is my own take on Demon Friday, except it's not always on Fridays and it doesn't feature real demons or pictures of real demons. Sorry.

These are all my posts on demons:

  1. The demon of Laplace, regarding probability.

  2. The demon of Maxwell, regarding thermodynamics.

  3. The demon of Descartes, designed to invoke skepticism.

  4. The demon of Morton, designed to make one aware of confirmation bias.




Inspired by this medieval motley crew, I decided to offer a grimoire of demons closer to my heart. Or perhaps closer to my head.

Pierre Simon Laplace image on Wikipedia

Pierre-Simon Laplace as captured by the Wikipedia paparazzi.

Laplace's Demon


Pierre-Simon Laplace is famous for being both French and smart simultaneously. In this rare combination, he managed to contribute to the development of mathematics and statistics. His contributions to statistics include an early version of Bayesian analysis.

Laplace was so impressed with the success of statistics and probability to determine guesstimates of the occurrences of events that he proposed the notion of Laplace's demon.

What is Laplace's Demon?


Laplace's demon is a hypothetical creature that - instead of hiding in your broom closet or underneath your bed - knows the exact location and momentum of each atom of the universe. Armed with this knowledge, Laplace claimed that his friendly demon would be able to predict the exact future location and momentum of each atom of the universe. In effect, Laplace's demon would know the past, the present and the future from analysis.

Pierre Simon Laplace demon

Pierre-Simon Laplace's demon as captured by the Wikipedia paparazzi.

Should we believe in Laplace's Demon?


Heisenberg's uncertainty principle states that there are difficulties with knowing both position and momentum of a body simultaneously. This means that we're stuck with at best half a demon at any given time. Perhaps Laplace's demon may give us the odds, but it can't give us certainty as to the causal outcome of a given event. Laplace's demon may fail due to interpretations of quantum mechanics. A more accurate description of Laplace's demon may then perhaps be Laplace's bookmaker of the universe.

28 June 2009

Bayesian Analysis: To probably be, or probably not be, depending on something else's probability

That man of science, Urikalish, loves to torment us superstitious, intuitive mortals who adore the Secret and the Law of Attraction with logic. This is his latest riddle:

Urikalish's Riddle


Let’s assume there’s a deadly disease that affects 1 in every 10 people.

Let's say there’s a pretty good test for this disease which is 90% accurate (that means that if a person is sick – the test will say he’s sick in 90% of the cases, and if a person is healthy – the test will say he’s healthy in 90% of the cases).

Now, assuming you took this 90% accurate test, and got a positive result that implies that you are sick - what are the odds that you are really sick?


Bayes's Theorem


The key to solving this riddle is Bayes's Theorem. Don't ask me why. I'm an elitist and I don't need to explain myself to the likes of you. Especially when I have no idea what I'm talking about.

Bayes's Theorem from Wikipedia

  • P(A|B): This is the probability of A, given B. This is what you are looking for. This is the posterior or revised probability that you have the disease, given the fact that you test positive.

  • P(B|A): This is the conditional probability, or the probability of B given A. In other words, the probability that you test positive, given that you have the disease.

  • P(A): This is the prior probability of A, or the prior probability that you have the disease, regardless of whether your test is positive or not.

  • P(B): This is the prior probability of B, or the prior probability that you test positive, whether you have the disease or not.


Smart people can fill in the data directly from Urikalish's riddle into Bayes's Theorem and get a result. Unfortunately, I played more with the glue and crayons than with the abacus and the clay when I was a kid, so I need something simpler.

An Intuitive Explanation of Bayes's Theorem


Eliezer S. Yudkowsky, that boy genius who tells us about his AI (that is, Almost Implemented) research, has the remarkable ability to make some really, really smart stuff seem really, really simple. This is Yudkowsky's explanation of Bayes's Theorem, which still went over my head (must've been toxic glue), so I tried something that is even more simple and more familiar to me, namely decision trees.

Using Decision Trees in Bayesian Analysis


Start at the beginning and make a split for those who have the disease, and those who are healthy. Branching of each node of the tree has to add up to 1, otherwise you're cooking Dutch books. Proceed up the tree, splitting each node into all the possible scenarios, and you'll eventually cover your entire sample space and thus have a visual representation of your full joint distribution.

decision tree Bayesian Analysis

Explanation


The probability of having the disease is equal to the amount of people who have the disease and test positive, divided by the total number of people who test positive.

If you said 90%, you are stating the probability that the test is right. This is a different probability than having the disease. If you said 10%, you are stating the probability that anybody has the disease, regardless of taking the test or not. The probability of having the disease is affected by both the probability that the test is right and the rarity of the disease.

The total number of people who have the disease here is 0,1, which is 10 %, or 10 out of the 100. The total number of people who test positive is 0,1 x 0,9 for those who have the disease (or 9 out of the original 100), and 0,9 x 0,1 of those who do not have the disease (also 9 out of the original 100). This means the total amount of people who test positive in the original population is 18 out of 100.

Finally, your answer 0,5 ie 50%. You get this from the 9 who test positive and do have the disease divided by 18 who test positive in the total population. The decision tree makes it visible who tested positive, so you are less likely to get confused. How likely? I don't know, draw your own damn tree.

Google sucks piles I'm moving to Steemit

Short and sweet, Google isn't allowing me to post ads on my blogs here on blogspot any longer. Not that I provide my angry nerd rants fo...