<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>oscarbonilla.com</title>
	<atom:link href="http://oscarbonilla.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://oscarbonilla.com</link>
	<description></description>
	<lastBuildDate>Mon, 26 Jul 2010 21:25:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>A neat trick for emailing web pages</title>
		<link>http://oscarbonilla.com/2010/07/a-neat-trick-for-emailing-web-pages/</link>
		<comments>http://oscarbonilla.com/2010/07/a-neat-trick-for-emailing-web-pages/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 21:25:06 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=771</guid>
		<description><![CDATA[I tend to email interesting articles to my wife, who normally does all her reading on her iPhone. I've found that if I send her a link, she will rarely click on it to read it, but if I email her the actual text of the article, she will read it. Since I do most [...]]]></description>
			<content:encoded><![CDATA[<p>I tend to email interesting articles to my wife, who normally does all her reading on her iPhone. I've found that if I send her a link, she will rarely click on it to read it, but if I email her the actual text of the article, she will read it. Since I do most of my browsing in Safari, I use the handy ⌘I shortcut ("File | Mail Contents of This Page" on the menu).</p>
<p>This is how it works. Say I'm reading this cool explanation of Bayes Theorem:</p>
<p><a href="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.17.17-PM.png" class="lightview" rel="gallery[771]" title="safari-bayes"><img class="alignnone size-medium wp-image-772" title="safari-bayes" src="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.17.17-PM-283x300.png" alt="" width="283" height="300" /></a></p>
<p>I hit ⌘I, and this is what I get:</p>
<p><a href="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.17.37-PM.png" class="lightview" rel="gallery[771]" title="Mail-bayes"><img class="alignnone size-medium wp-image-773" title="Mail-bayes" src="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.17.37-PM-250x300.png" alt="" width="250" height="300" /></a></p>
<p>I just discover that if you are in Safari Reader mode (⇧⌘R) when you are reading the page:</p>
<p><a href="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.17.49-PM.png" class="lightview" rel="gallery[771]" title="safari-reader"><img class="alignnone size-medium wp-image-774" title="safari-reader" src="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.17.49-PM-300x291.png" alt="" width="300" height="291" /></a></p>
<p>and hit ⌘I without leaving Reader mode, this is what you get:</p>
<p><a href="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.18.05-PM1.png" class="lightview" rel="gallery[771]" title="Mail-reader"><img class="alignnone size-medium wp-image-776" title="Mail-reader" src="http://oscarbonilla.com/wp-content/uploads/2010/07/Screen-shot-2010-07-26-at-2.18.05-PM1-250x300.png" alt="" width="250" height="300" /></a></p>
<p>Ah, much better. Thank you Apple.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/07/a-neat-trick-for-emailing-web-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Think, don&#8217;t Blink!</title>
		<link>http://oscarbonilla.com/2010/06/think-dont-blink/</link>
		<comments>http://oscarbonilla.com/2010/06/think-dont-blink/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 16:45:45 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=760</guid>
		<description><![CDATA[I'm a big fan of Malcolm Gladwell, but I classify his books more as fiction than science. My problem with Gladwell as a science writer is that he always seems to be very selective on the research he presents to his readers. Thus he presents half the issue and makes it up to be "proven" [...]]]></description>
			<content:encoded><![CDATA[<p><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/2pK0BQ9CUHk'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/2pK0BQ9CUHk' type='application/x-shockwave-flash' wmode='transparent' width='425' height='350'></embed></object></span></p>
<p>I'm a big fan of <a href="http://en.wikipedia.org/wiki/Malcolm_Gladwell">Malcolm Gladwell</a>, but I classify his books more as fiction than science. My problem with Gladwell as a science writer is that he always seems to be very selective on the research he presents to his readers. Thus he presents half the issue and makes it up to be "proven" by science. I've meant to write some thoughts on <a href="http://www.amazon.com/Blink-Power-Thinking-Without/dp/0316172324">Blink!</a>, which I read a while ago, but never finished writing them. Now Daniel J. Simons and Christopher F. Chabris have beaten me to it with "<a href="http://chronicle.com/article/The-Trouble-With-Intuition/65674/">The Trouble With Intuition</a>"[1]. Here are some good parts:</p>
<blockquote><p>The most troublesome aspect of intuition may be the misleading role it plays in how we perceive patterns and identify causal relationships. When two events occur in close temporal proximity, and the first one plausibly could have caused the second one, we tend to infer that this is what must have happened.</p></blockquote>
<p>I have found that even after constantly repeating "correlation does not imply causation", I still botch it all the time unless I'm actively reminding myself to NOT jump to conclusions before analyzing. The sweet temptation to go with intuition is just too, uh, sweet... and... tempting? Hmm.. okay, let's move along.</p>
<blockquote><p>Take the case of the perceived link between childhood vaccinations and autism. Nowadays children receive several vaccines before age 2, and autism is often diagnosed in 2- and 3-year-olds. When a child is diagnosed with autism, parents naturally and understandably seek possible causes. Vaccination involves the introduction of unusual foreign substances (dead viruses, attenuated live viruses, and preservative chemicals) into the body, so it's easy to imagine that those things could profoundly affect a child's behavior. But more than a dozen large-scale epidemiological studies, involving hundreds of thousands of subjects, have shown that children who were vaccinated are no more likely to be diagnosed with autism than are children who were not vaccinated. In other words, there is no association between vaccination and autism. And in the absence of an association, there cannot be a causal link.</p></blockquote>
<p>I've always been baffled at that "vaccination causes autism" debate. In the scientific community there seems to be no debate. And even if "correlation does not imply causation", correlation is a necessary condition for causation. And later on, we find this gem:</p>
<blockquote><p>In a way, intuition and statistics are like oil and water: They can easily coexist in our minds without ever interacting.</p></blockquote>
<p>This is a fantastic analogy, and I have many times been seduced by intuition only to find myself on wild goose chases. The whole piece is worth reading.</p>
<ol class="footnotes"><li id="footnote_0_760" class="footnote">Which proves once again my maxim that if you wait long enough to do something, either somebody else does it or it becomes irrelevant.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/06/think-dont-blink/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone killer? Again?</title>
		<link>http://oscarbonilla.com/2010/05/iphone-killer-again/</link>
		<comments>http://oscarbonilla.com/2010/05/iphone-killer-again/#comments</comments>
		<pubDate>Mon, 24 May 2010 19:04:59 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[rants]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Palm]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=752</guid>
		<description><![CDATA[Here is a mistake that I've seen companies competing with the iPhone make more than once. Comparing the currently shipping version of the iPhone with their not-quite-shipping-yet phone. Palm did it. They put out a kick-ass product that would've blown the original iPhone out of the water or at least given it a run for [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a mistake that I've seen companies competing with the iPhone make more than once. Comparing the currently shipping version of the iPhone with their not-quite-shipping-yet phone.</p>
<p>Palm did it. They put out a kick-ass product that would've blown the original iPhone out of the water or at least given it a run for its money. Unfortunately they did it about a year and a half too late. The world had moved on and the reaction was "meh". Then they ran out of money.</p>
<p>Google is doing it right now. They announced Froyo running on the Nexus One and it kicks the iPhone 3GS sorry little ass. Except the 3GS has been shipping for over a year. Do they think Apple has spent a year doing nothing? Of course not, we've seen the leaks of the new iPhone. The new iPhone will be based on the A4 CPU and my prediction is that it will be faster than the Nexus One.</p>
<p>If you want to compete with Apple, don't copy last years products. Look AHEAD, to what's coming.</p>
<p>P.S. I'm no longer reading any articles that have the phrase "iPhone Killer" in them (including this one ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/05/iphone-killer-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lucia de Berk</title>
		<link>http://oscarbonilla.com/2010/04/lucia-de-berk/</link>
		<comments>http://oscarbonilla.com/2010/04/lucia-de-berk/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 23:19:09 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=741</guid>
		<description><![CDATA[This is infuriating. In June 2004, Lucia was convicted of 7 murders and 3 attempted murders by the Court of Appeal in The Hague. She was given a life sentence; in view of the lack of evidence, a perplexing sentence. There are no eye witnesses, there is no direct incriminating evidence. Lucia was never seen [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://luciadeb.nl/english/summary.html">This</a> is infuriating.</p>
<blockquote><p>In June 2004, Lucia was convicted of 7 murders and 3 attempted murders by the Court of Appeal in The Hague. She was given a life sentence; in view of the lack of evidence, a perplexing sentence. There are no eye witnesses, there is no direct incriminating evidence. Lucia was never seen in a suspicious situation. She was never found in possession of any of the poisons she was alleged to have used.</p></blockquote>
<p>So how did they catch this supposed murderer? Why were they even investigating her?</p>
<blockquote><p>Everything started with an at first glance striking number of incidents (deaths or resuscitations) during Lucia’s shifts at the Juliana Children’s Hospital in the Hague: the JKZ. The run drew attention to her. Seven incidents in a row all in the shifts of one nurse could not possibly be a matter of chance! The services of a former statistician, now professor of Psychology of Law, Henk Elffers, were called in, and the number he came up with must have wiped out all remaining doubt. He figured that the probability that all of seven incidents could have happened during Lucia’s shifts by pure chance was 1 in 6,000,000,000.</p></blockquote>
<p>So instead of looking at the data to support a theory, they looked at the data to <em>form</em> a theory. This is totally the wrong approach. You can find all sorts of patterns given a large enough data set. That is why seasoned researchers form a theory first and then analyze or gather data in order to test the theory. If you have no theory you're just doing <a href="http://en.wikipedia.org/wiki/Cargo_cult_science">cargo cult science</a>. As for the 1 in 6,000,000,000 chance, it looks like a case of the <a href="http://en.wikipedia.org/wiki/Birthday_problem">Birthday Paradox</a>. Given enough deaths and nurses, the probability of <em>some</em> nurse being present in 7 consecutive deaths <a href="http://www.math.leidenuniv.nl/~gill/hetero2.pdf">is pretty high</a>. Ben Goldacre has <a href="http://www.badscience.net/2010/04/lucia-de-berk-a-martyr-to-stupidity/">more</a>.</p>
<blockquote><p>Even more bizarre was the staggering foolishness by some of the statistical experts used in the court. One, Henk Elffers, a professor of law, combined individual statistical tests by taking p-values – a mathematical expression of statistical significance – and multiplying them together. This bit is for the nerds: you do not just multiply p-values together, you weave them with a clever tool, like maybe ‘Fisher’s method for combination of independent p-values’. If you multiply p-values together, then chance incidents will rapidly appear to be vanishingly unlikely. Let’s say you worked in twenty hospitals, each with a pattern of incidents that is purely random noise: let’s say p=0.5. If you multiply those harmless p-values, of entirely chance findings, you end up with a final p-value of p &lt; 0.000001, falsely implying that the outcome is extremely highly statistically significant. With this mathematical error, by this reasoning, if you change hospitals a lot, you automatically become a suspect.</p></blockquote>
<p>Multiplying p-values? Really?</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/04/lucia-de-berk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pigeons Beat Students at Probabilities</title>
		<link>http://oscarbonilla.com/2010/04/pigeons-beat-students-at-probabilities/</link>
		<comments>http://oscarbonilla.com/2010/04/pigeons-beat-students-at-probabilities/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 18:05:38 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=737</guid>
		<description><![CDATA[Interesting. Pigeons outperform humas at the Monty Hall problem. First the pigeons: Each pigeon was faced with three lit keys, one of which could be pecked for food. At the first peck, all three keys switched off and after a second, two came back on including the bird’s first choice. The computer, playing the part [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.discovermagazine.com/notrocketscience/2010/04/02/pigeons-outperform-humans-at-the-monty-hall-dilemma/">Interesting</a>. Pigeons outperform humas at the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem">Monty Hall problem</a>. First the pigeons:</p>
<blockquote><p>Each pigeon was faced with three lit keys, one of which could be pecked for food. At the first peck, all three keys switched off and after a second, two came back on including the bird’s first choice. The computer, playing the part of Monty Hall, had selected one of the unpecked keys to deactivate. If the pigeon pecked the right key of the remaining two, it earned some grain. On the first day of testing, the pigeons switched on just a third of the trials. But after a month, all six birds switched almost every time, earning virtually the maximum grainy reward.</p></blockquote>
<p>Then the students:</p>
<blockquote><p>At first, they were equally likely to switch or stay. By the final trial, they were still only switching on two thirds of the trials. They had edged towards the right strategy but they were a long way from the ideal approach of the pigeons. And by the end of the study, they were showing no signs of further improvement.</p></blockquote>
<p>There is something to be said about our preconceptions and how biased we can be when looking at data. Pigeons are immune to this.</p>
<blockquote><p>Despite our best attempts at reasoning, most of us arrive at the wrong answer.</p></blockquote>
<blockquote><p>Pigeons, on the other hand, rely on experience to work out probabilities. They have a go, and they choose the strategy that seems to be paying off best.</p></blockquote>
<p>I've written about the Monty Hall Problem <a href="http://oscarbonilla.com/2009/05/the-monty-hall-problem/">here</a>.</p>
<p>P.S. In case you missed the joke, look <a href="http://theprez98.blogspot.com/2010/03/template-for-how-to-write-bruce.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/04/pigeons-beat-students-at-probabilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Probabilities</title>
		<link>http://oscarbonilla.com/2010/04/probabilities/</link>
		<comments>http://oscarbonilla.com/2010/04/probabilities/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 05:17:15 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=706</guid>
		<description><![CDATA[Introduction For the past couple of weeks I've been trying to write an article explaining briefly what p-values are and what they really measure. Turns out there are enough subtleties involved that I keep writing and writing and haven't published anything. So I've decided that it's time for a change of tactic. I'm going to [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p style="text-align: left;">For the past couple of weeks I've been trying to write an article explaining briefly what p-values are and what they really measure. Turns out there are enough subtleties involved that I keep writing and writing and haven't published anything. So I've decided that it's time for a change of tactic.</p>
<p style="text-align: left;">I'm going to work my way up to p-values, explaining in detail each of the pieces. Then, when I'm done, I will write a summary that just links back to the longer explanations and hopefully I'll be able then to summarize the journey and write a more succinct explanation.</p>
<p style="text-align: left;">This is the first installment of the series, and it deals with the basic idea of probabilities.</p>
<p style="text-align: left;"><div id="stb-container" class="stb-container"><div class='stb-info-caption_box stb_caption' style="color:#000000; border-top-color: #bbbbbb; border-left-color: #bbbbbb; border-right-color: #bbbbbb; border-bottom-color: #bbbbbb; background-color: #bbbbbb; ">For Math Geeks</div><div class='stb-info-body_box stb_body' style="border-top-color: #bbbbbb; border-left-color: #bbbbbb; border-right-color: #bbbbbb; border-bottom-color: #bbbbbb; background-color: #ffffff; ">In these boxes you'll find formal definitions that are intended to complement the main text. If you are <strong>not</strong> a math geek, you can safely ignore these.</div></div></p>
<p style="text-align: right;">Let's start at the very beginning,<br />
a very good place to start.<br />
<em>– Maria (The Sound of Music)</em></p>
<h2>In the beginning there were probabilities</h2>
<p>The idea behind naïve probabilities is simple. You have a Universe of all possible outcomes of some experiment (sometimes called a sample space and denoted by the greek letter Omega:<img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_e948798df2a34079920cab333c54a490.png" title="\Omega" style="vertical-align:-20%;" class="tex" alt="\Omega" />), and you are interested in some subset of them, namely some event (denoted by <img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_9e021374aed36323cad429d5234ddd96.png" title="E" style="vertical-align:-20%;" class="tex" alt="E" />). The probability of event <img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_9e021374aed36323cad429d5234ddd96.png" title="E" style="vertical-align:-20%;" class="tex" alt="E" /> occurring is the cardinality (number of elements) of <img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_9e021374aed36323cad429d5234ddd96.png" title="E" style="vertical-align:-20%;" class="tex" alt="E" /> over all the possible outcomes (cardinality of <img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_e948798df2a34079920cab333c54a490.png" title="\Omega" style="vertical-align:-20%;" class="tex" alt="\Omega" />).</p>
<p><center><img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_f3fafe77cad4008a513a15262e512c9d.png" title="P(E)=\displaystyle\frac{|E|}{|\Omega|}" style="vertical-align:-20%;" class="tex" alt="P(E)=\displaystyle\frac{|E|}{|\Omega|}" /></center></p>
<p>Say you are throwing a pair of dice. How many possible outcomes of this experiment can there be? If you ignore the possible but unlikely event that one of the die will land on its edge, there are 36 possible outcomes. That means that the probability of getting snake eyes (two ones) is 1/36. You could even enumerate all the outcomes and construct a set like {(1, 1), (1, 2), ... (6, 6)} where each pair (x, y) represents die 1 landing on x and die 2 landing on y.</p>
<p>I said naïve before because this assignment of probabilities makes a couple of implicit assumptions about the sample space and the events. First of all, it assumes that the sample space is finite. I'm going to completely ignore infinite sample spaces and instead focus on the second implicit assumption: that each outcome is equally likely.</p>
<p>What if some outcomes are more likely than others? For example, what if the dice are loaded? All of a sudden 1/36 doesn't look like such a good probability assignment for snake eyes.</p>
<p>In the general sense, you don't <em>have to</em> assign equal probabilities to each of the outcomes. It's usually just a good starting point to assume that this is the case. But if you <strong>know</strong> that this is not the case, then starting with equal probabilities is not very smart.</p>
<p>As an example, in the <a href="http://oscarbonilla.com/2009/05/the-monty-hall-problem/">Monty Hall problem</a>, if you second cousin thrice removed is part of the staff and he lets you in that the car is not in door number three, that completely changes the problem. You would never assign P = 1/3 to each of the doors. You know for a fact that the probability of the car being behind door number three is exactly zero.</p>
<p>In a general sense then, probabilities can't be defined by just counting possible outcomes. They must be defined as general functions that map a set of outcomes to numbers between zero and one. They must, of course, satisfy some special properties.</p>
<p><div id="stb-container" class="stb-container"><div class='stb-info-caption_box stb_caption' style="color:#000000; border-top-color: #bbbbbb; border-left-color: #bbbbbb; border-right-color: #bbbbbb; border-bottom-color: #bbbbbb; background-color: #bbbbbb; ">For Math Geeks</div><div class='stb-info-body_box stb_body' style="border-top-color: #bbbbbb; border-left-color: #bbbbbb; border-right-color: #bbbbbb; border-bottom-color: #bbbbbb; background-color: #ffffff; ">A probability function <img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_7377fea273cbc192f883469992265332.png" title="P" style="vertical-align:-20%;" class="tex" alt="P" /> maps a sample space (<img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_7f96f6b17bfb3e8e80c88592d4d0a7a4.png" title=" \Omega" style="vertical-align:-20%;" class="tex" alt=" \Omega" />) to a number in the interval <img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_fa1c7732213579436cabb32ba36abbdb.png" title="[0,1]" style="vertical-align:-20%;" class="tex" alt="[0,1]" />, and satisfies the following three properties:</p>
<ol>
<li><img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_635bdb5bf787b9836781109afd284126.png" title=" P(E) \ge 0 \textrm{ for every } E" style="vertical-align:-20%;" class="tex" alt=" P(E) \ge 0 \textrm{ for every } E" /></li>
<li><img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_fed5322425ff62d35aac743fb36dda29.png" title=" P(\Omega) = 1" style="vertical-align:-20%;" class="tex" alt=" P(\Omega) = 1" /></li>
<li><img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_86e1dfe335704714907f18c2d43fae03.png" title="\textrm{if }E_1, E_2, \ldots \textrm{ are disjoint, then }" style="vertical-align:-20%;" class="tex" alt="\textrm{if }E_1, E_2, \ldots \textrm{ are disjoint, then }" /> <center><img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_34d0524c534af9bd26fa3642966999b7.png" title=" P\left(\displaystyle\bigcup_{i=1}^{\infty}E_i\right) = \displaystyle\sum_{i=1}^{\infty}P(E_i)" style="vertical-align:-20%;" class="tex" alt=" P\left(\displaystyle\bigcup_{i=1}^{\infty}E_i\right) = \displaystyle\sum_{i=1}^{\infty}P(E_i)" /></center></div></div></li>
</ol>
<p>But notice that the previous definition of probabilities (<img src="http://oscarbonilla.com/wp-content/plugins/easy-latex/cache/tex_85f627b2b1e4a6691aa96921630e6e11.png" title="|E|/|\Omega|" style="vertical-align:-20%;" class="tex" alt="|E|/|\Omega|" />) was very handy in the sense that just by knowing the cardinalities we had the appropriate probabilities. If we assign the probabilities unevenly, how do we describe them without having to enumerate each one individually?</p>
<p>This is where probability distributions help. And that will be the subject of the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/04/probabilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mandoline my ass&#8230;</title>
		<link>http://oscarbonilla.com/2010/02/mandoline-my-ass/</link>
		<comments>http://oscarbonilla.com/2010/02/mandoline-my-ass/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 04:10:10 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=452</guid>
		<description><![CDATA[...all you need is a sharp knife. I just got The French Laundry Cookbook. It's awesome.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://oscarbonilla.com/wp-content/uploads/2010/02/IMG_6499.jpg" class="lightview" rel="gallery[452]" title="Strawberry"><img class="size-medium wp-image-453 aligncenter" title="Strawberry" src="http://oscarbonilla.com/wp-content/uploads/2010/02/IMG_6499-300x199.jpg" alt="" width="300" height="199" /></a></p>
<p style="text-align: left;">...all you need is a <a href="http://www.amazon.com/gp/product/B00005OL44?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B00005OL44" target="_blank">sharp knife</a>.</p>
<p style="text-align: left;">I just got <a href="http://www.amazon.com/gp/product/1579651267?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1579651267" target="_blank">The French Laundry Cookbook</a>. It's awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/02/mandoline-my-ass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unleash the power of the atom&#8230; to boil water?</title>
		<link>http://oscarbonilla.com/2010/02/unleash-the-power-of-the-atom-to-boil-water/</link>
		<comments>http://oscarbonilla.com/2010/02/unleash-the-power-of-the-atom-to-boil-water/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 05:14:45 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Stuff I Know Nothing About]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=446</guid>
		<description><![CDATA[I'm going to go off on a limb and blog about something I know absolutely nothing about. Power generation. So I'm reading the news recently and I read that the U.S. is going to invest in building a couple of nuclear power plants. Now, I don't know much about nuclear power plants or power generation [...]]]></description>
			<content:encoded><![CDATA[<p>I'm going to go off on a limb and blog about something I know absolutely nothing about. Power generation.</p>
<p>So I'm reading the news recently and I read that the U.S. is going to invest in building a couple of nuclear power plants. Now, I don't know much about nuclear power plants or power generation in general. But I know how to use the googles for finding out about stuff I don't know much about. So I hit wikipedia and all those other websites and I find about all of these wonderful methods of generating power.</p>
<p><strong>Fossil Fuels:</strong> Coal for instance. Oil and natural gas too. The main idea is to burn these fossil fuels in order to boil water so that the steam can make a turbine spin and generate electricity using a big electromagnet.</p>
<p><strong>Nuclear Fission:</strong> Create a controlled nuclear reaction so that we can heat up water and produce steam to spin a turbine hooked up to a huge electromagnet.</p>
<p><strong>Geothermal Power:</strong> Drill a very, very deep hole to reach the hot granite that underlies the earth's crust. This granite is so hot we can use it to... boil water... steam... turbine... electromagnet.</p>
<p><strong>Hydroelectric:</strong> Just avoid the whole boiling water bit and spin the turbine directly from a river.</p>
<p><strong>Tidal Power:</strong> Make a dam in the ocean and put the turbine there.</p>
<p><strong>Wind Power:</strong> Instead of boiling water and using steam, use wind to spin the turbine.</p>
<p><strong>Solar power: </strong>At this point, if I had read that we were using solar to boil water I would've just given up hope for humanity. But no, at least with solar we actually just use the energy... no turbine involved.</p>
<p>So my question for more informed readers is: uh, how about <strong>not</strong> needing the turbine and using some other method of gathering the released energy? Especially in the case of Nuclear Fission. It seems somewhat wasteful to fire up an atomic bomb just to boil some water...</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/02/unleash-the-power-of-the-atom-to-boil-water/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enjoying Life (a little more)</title>
		<link>http://oscarbonilla.com/2010/01/enjoying-life-a-little-more/</link>
		<comments>http://oscarbonilla.com/2010/01/enjoying-life-a-little-more/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 05:24:42 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=339</guid>
		<description><![CDATA[This is a post about a simple trick you can use to enjoy the things you like a little more and/or make them enjoyable to others. But first, let's try a little experiment. Please listen to this piece of classical music. It's only 47 seconds long. Now write down some measure of how much you enjoyed [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post about a simple trick you can use to enjoy the things you like a little more and/or make them enjoyable to others. But first, let's try a little experiment. Please listen to this piece of classical music. It's only 47 seconds long.</p>
<p style="text-align: left;"><!-- degradable html5 audio and video plugin --><div class="audio_wrap html5audio"><div style="display:none;"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" title="Click to open" id="f-html5audio-0">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-0", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3"});</script></div><audio controls autobuffer id="html5audio-0" class="html5audio"><source src="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" type="audio/mpeg" /><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" title="Click to open" id="f-html5audio-0">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-0", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3"});</script></audio></div><script type="text/javascript">if (jQuery.browser.mozilla) {tempaud=document.getElementsByTagName("audio")[0]; jQuery(tempaud).remove(); jQuery("div.audio_wrap div").show()} else jQuery("div.audio_wrap div *").remove();</script></p>
<p style="text-align: left;">Now write down some measure of how much you enjoyed it on whatever scale you want. Five stars, a number from one to ten, whatever. Ready? Okay, now read the following story.</p>
<p style="text-align: center;"><img class="aligncenter size-medium wp-image-403" src="http://oscarbonilla.com/wp-content/uploads/2010/01/Bach_Seal_wide-300x134.jpg" alt="" width="108" height="48" /></p>
<p style="text-align: left;">On the evening of May 7, 1747  in the grounds of the just finished <a href="http://en.wikipedia.org/wiki/Sanssouci">Sansoucci</a> palace of <a href="http://en.wikipedia.org/wiki/Frederick_II_of_Prussia">Frederick the Great</a>, King of <a href="http://en.wikipedia.org/wiki/Kingdom_of_Prussia">Prussia</a>, a 62-year old man arrives by carriage. As was the custom in those days, an officer writes his name in a list of visitors which is usually reviewed by the King.</p>
<p>Inside the palace, through the Entrance Hall and to the left, King Frederick is in an exquisitely decorated room, getting his flute ready for the nightly concert while the rest of the musicians tune up. The officer enters the room and gives the King the list of strangers who have arrived to the palace.</p>
<p style="text-align: left;">With his flute in his hand, Frederick runs down the list and immediately turns to the assembled musicians, exclaiming with a kind of agitation, “Gentlemen, old Bach is come.” He lays his flute aside, and announces to the other musicians and the rest of the people of the court that there will be no concert tonight.</p>
<p style="text-align: left;">
<div id="attachment_405" class="wp-caption aligncenter" style="width: 535px"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/800px-Flötenkonzert1.jpg"><img class="size-full wp-image-405    " title="800px-Flötenkonzert" src="http://oscarbonilla.com/wp-content/uploads/2010/01/800px-Flötenkonzert1.jpg" alt="" width="525" height="358" /></a><p class="wp-caption-text">Das Flötenkonzert Friedrich des Großen in Sanssouci by Adolph von Menzel</p></div>
<p style="text-align: left;">
<p><a href="http://en.wikipedia.org/wiki/Bach">Johann Sebastian Bach</a> has just arrived for a visit to his son <a href="http://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach">Carl Philip Emanuel Bach</a>, the court’s Capellmeister. The King had been wanting to meet with J.S. Bach, and his wish had just been realized. So without even giving Bach time to change from his traveling clothes to a more formal black chanter's gown, the King summons him to appear before his Highness. Frederick, after listening to Bach’s apology for his appearance, invites him to try his collection of <a href="http://http://en.wikipedia.org/wiki/Fortepiano#Silbermann_fortepianos">Silbermann fortepianos</a>, which are scattered throughout the palace.</p>
<p>The musicians follow them from room to room, and Bach is invited everywhere to try the fortepianos and play unpremeditated compositions. After going on for some time, Bach asks the King, “Would Your Highness be so kind as to honor me with a subject for a Fuge, so that I can execute it immediately and without any preparation?” The King, desiring to give such a learned musician a challenge, picks up his flute and plays the following tune:</p>
<p style="text-align: left;"><!-- degradable html5 audio and video plugin --><div class="audio_wrap html5audio"><div style="display:none;"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3" title="Click to open" id="f-html5audio-1">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-1", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3"});</script></div><audio controls autobuffer id="html5audio-1" class="html5audio"><source src="http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3" type="audio/mpeg" /><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3" title="Click to open" id="f-html5audio-1">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-1", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3"});</script></audio></div><script type="text/javascript">if (jQuery.browser.mozilla) {tempaud=document.getElementsByTagName("audio")[0]; jQuery(tempaud).remove(); jQuery("div.audio_wrap div").show()} else jQuery("div.audio_wrap div *").remove();</script></p>
<p style="text-align: left;">
<div id="attachment_411" class="wp-caption aligncenter" style="width: 510px"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/500px-The_Musical_Offering_theme.svg_.png" class="lightview" rel="gallery[339]" title="500px-The_Musical_Offering_theme.svg"><img class="size-full wp-image-411" title="500px-The_Musical_Offering_theme.svg" src="http://oscarbonilla.com/wp-content/uploads/2010/01/500px-The_Musical_Offering_theme.svg_.png" alt="" width="500" height="42" /></a><p class="wp-caption-text">The King&#39;s Theme</p></div>
<p>This is quite a complex melody! One of which Michelle Rasmussen says:</p>
<blockquote><p>The King’s theme begins with a C minor triad, (“c - e flat – g”), is raised to the next half-note above that, “a flat,” and then takes a dramatic downward leap of a seventh from the "a flat" down to “B,” not included in C minor, but found in C major. This creates musical tension between two pairs of half-step intervals: from the ”B”  back to the beginning “C,” and the “g - a flat” interval.</p>
<p>Picking up on these half-steps from the first part, the second part of the Royal theme is a revolutionary ambiguous step-wise descent from the top of the triad, “g” one octave down to "G," comprised of a chromatic descent from "g" to "B", and then, down by major scale steps to  “G.” The concluding section hops up through "c" to "f," and ends with a stepwise journey down the C-minor scale from f, through "e flat," to end where it began on "c."</p></blockquote>
<p>Bach is silent for a couple of seconds, but he accepts the King's challenge. He plays the King's theme three times before proceeding to play a beautiful three-voice Fugue. Please listen to the first minute of it:</p>
<p style="text-align: left;"><!-- degradable html5 audio and video plugin --><div class="audio_wrap html5audio"><div style="display:none;"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3" title="Click to open" id="f-html5audio-2">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-2", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3"});</script></div><audio controls autobuffer id="html5audio-2" class="html5audio"><source src="http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3" type="audio/mpeg" /><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3" title="Click to open" id="f-html5audio-2">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-2", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3"});</script></audio></div><script type="text/javascript">if (jQuery.browser.mozilla) {tempaud=document.getElementsByTagName("audio")[0]; jQuery(tempaud).remove(); jQuery("div.audio_wrap div").show()} else jQuery("div.audio_wrap div *").remove();</script></p>
<p>The King, impressed by the three-voice Fuge improvised by Bach, and to see how far such art could be carried, requests to hear a Fuge with six voices. Fearing he cannot, without preparation, invent such a complex Fuge based on the King's theme, Bach asks permission of the King to pick his own subject, which the King gently concedes. Bach proceeds then to execute it to the astonishment of all present in the same magnificent and learned manner as he had done that of the King.</p>
<p>After returning home to Leipzig, Bach composes a three-voiced and a six-voiced <a href="http://en.wikipedia.org/wiki/Fugue">fugue</a>, ten <a href="http://en.wikipedia.org/wiki/Canon_(music)">canons</a>, and a <a href="http://en.wikipedia.org/wiki/Sonata">sonata</a> for flute, violin, and piano. All based on the King's theme. This work has become known as the <a href="http://en.wikipedia.org/wiki/The_Musical_Offering">Musikalisches Opfer</a> (Musical Offering), after a phrase from Bach’s dedication to King Frederick[1].</p></blockquote>
<p>Bach sends this <em>Musical Offering</em> to King Frederick, and on the page preceding the first sheet of music, he inscribes: <em>Regis Iussu Cantio Et Reliqua Canonica Arte Resoluta,</em> meaning "At the King's Command, the Song and the Remainder Resolved with Canonic Art." an acrostic spelling "<a href="http://en.wikipedia.org/wiki/Ricercar">RICERCAR</a>," the original name for the musical form now known as the Fuge. Bach also uses this title for the two fugues. Ricercar is also an Italian word meaning "to seek", which is appropriate since Bach doesn't quite write <em>all</em> the music. He leaves hints on how to complete the scores as musical puzzles for the King to solve.</p>
<p>One example of these puzzles is the work entitled "Canon a 2 (Cancrizans)". The original score looks like this:</p>
<div id="attachment_412" class="wp-caption aligncenter" style="width: 382px"><img class="size-full wp-image-412" title="Canon-2a-Cancrizans" src="http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-2a-Cancrizans.gif" alt="" width="372" height="151" /><p class="wp-caption-text">Canon a 2 (Cancrizans)</p></div>
<p>The title "Canon a 2" implies it's a two-voice canon, but the score only shows one voice. There are hints in the score for solving the puzzle of the second voice:</p>
<ul>
<li> <em>Cancrizan</em> is Medieval-Latin meaning "to move backwards" literally <em>crab-like</em>.</li>
<li>There is an extra clef at the end of the score, and it is backwards.</li>
<li>The three flats at the end of the score are also facing backwards.</li>
</ul>
<p>All of these hints strongly imply that the second voice (the follower) is the same as the first voice (the leader) only played backwards. What you listened to in the beginning was Canon a 2 (Cancrizan) as performed by the <a href="http://www.stuttgarter-kammerorchester.de/">Stuttgarter Kammerorchester</a> under the direction of <a href="http://en.wikipedia.org/wiki/Karl_Münchinger">Karl Münchinger</a>. Listen to it again:</p>
<p style="text-align: center;"><!-- degradable html5 audio and video plugin --><div class="audio_wrap html5audio"><div style="display:none;"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" title="Click to open" id="f-html5audio-3">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-3", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3"});</script></div><audio controls autobuffer id="html5audio-3" class="html5audio"><source src="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" type="audio/mpeg" /><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" title="Click to open" id="f-html5audio-3">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-3", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3"});</script></audio></div><script type="text/javascript">if (jQuery.browser.mozilla) {tempaud=document.getElementsByTagName("audio")[0]; jQuery(tempaud).remove(); jQuery("div.audio_wrap div").show()} else jQuery("div.audio_wrap div *").remove();</script></p>
<p>But note that since the second voice is the same as the first voice, only played backwards. We should be able to reverse the recording and the canon should still sound the same! Listen to the same canon being played backwards:</p>
<!-- degradable html5 audio and video plugin --><div class="audio_wrap html5audio"><div style="display:none;"><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3" title="Click to open" id="f-html5audio-4">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-4", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3"});</script></div><audio controls autobuffer id="html5audio-4" class="html5audio"><source src="http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3" type="audio/mpeg" /><a href="http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3" title="Click to open" id="f-html5audio-4">Audio MP3</a><script type="text/javascript">AudioPlayer.embed("f-html5audio-4", {soundFile: "http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3"});</script></audio></div><script type="text/javascript">if (jQuery.browser.mozilla) {tempaud=document.getElementsByTagName("audio")[0]; jQuery(tempaud).remove(); jQuery("div.audio_wrap div").show()} else jQuery("div.audio_wrap div *").remove();</script>
<p>Now listen to the original canon once again. How much, on your same scale, did you enjoy it this time? Was it more? Significantly more? How likely are you to want to listen to the rest of the Musical Offering? For example by buying one of these two CDs?</p>
<p style="text-align: center;"><a style="border: none;" href="http://www.amazon.com/gp/product/B000VHKJSU?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B000VHKJSU&quot;"><img class="size-full wp-image-413 alignnone" src="http://oscarbonilla.com/wp-content/uploads/2010/01/MO_Munchinger.jpg" alt="" width="160" height="159" /></a> <a style="border: none;" href="http://www.amazon.com/gp/product/B000QR3R3E?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B000QR3R3E" target="_blank"><img class="size-full wp-image-414  alignnone" src="http://oscarbonilla.com/wp-content/uploads/2010/01/MO_Savall.jpg" alt="" width="160" height="159" /></a></p>
<p style="text-align: left;">If you are like most people, you found the second hearing much more enjoyable than the first. This is because your expectations, the context in which you have an experience, and how much you know about something all have a big effect on how much enjoyment you derive. Reading the story taught you something about the music, it served as a guide of what to look for. Sure, it helps that this is a musical masterpiece by the best baroque composer there is. But the effect works, even if <em>the story is false</em>.</p>
<p style="text-align: left;">Oh, I'm not saying that the above story didn't happen. I dressed it up a little, but the story is true. However, take a look at the <a href="http://significantobjects.com">Significant Objects</a> project. They take an insignificant object (bought at a Thrift store) and ask a writer to make up a back story for it. Then they sell it on ebay. They are careful to disclose that the story is false, and they donate the proceedings to charity. But how much do the objects gain in value? <a href="http://significantobjects.com/2009/08/25/russian-figure/">This Russian Figurine</a> that they bought for $3 was sold for $193.50!</p>
<p style="text-align: left;">In one <a href="http://www.boston.com/bostonglobe/ideas/articles/2008/02/24/grape_expectations/">experiment</a>, scientists at Caltech and Stanford told people they would be tasting wines ranging in price from $5 to $90, and asked them to rate the wines. Unsurprisingly, the more expensive wines were rated higher than the cheap wines. The twister? All the samples were the exact same wine. Since people expected the more expensive wine to taste better, it tasted better.</p>
<p style="text-align: left;">So here is the trick I promised you. If you want to make an experience more enjoyable, find or create a backstory. It's better if the story is true and you believe it, but it works even if it's a made up story.</p>
<p style="text-align: center;"><a href="http://en.wikipedia.org/wiki/BACH_motif"><img class="alignnone size-full wp-image-425" title="BACH" src="http://oscarbonilla.com/wp-content/uploads/2010/01/200px-Bachscross.svg_.png" alt="" width="90" height="90" /></a></p>
<p style="text-align: left;">For much more information about the canons of Bach's Musical Offering, look <a href="http://schillerinstitut.dk/moweb/musical_offering.htm">here</a>, or <a href="http://jan.ucc.nau.edu/~tas3/musoffcanons.html">here</a>.</p>
<p style="text-align: left;">
<p style="text-align: left;">
<ol class="footnotes"><li id="footnote_0_339" class="footnote">This is the letter of dedication that Bach sent to the King (quoted from <em><a href="http://www.amazon.com/gp/product/0393319563?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0393319563">The New Bach Reader</a></em>, p. 226-8):</p>
<blockquote><p>MOST GRACIOUS KING!</p>
<p>In deepest humility I dedicate herewith to Your Majesty a musical offering, the noblest part of which derives from Your Majesty's own august hand. With awesome pleasure I still remember the very special Royal grace when, some time ago, during my visit in Potsdam, Your Majesty’s Self deigned to play to me a theme for a fugue upon the clavier, and at the same time charged me most graciously to carry it out in Your Majesty’s most august presence. To obey Your Majesty’s command was my most humble duty. I noticed very soon, however, that, for lack of necessary preparation, the execution of the task did not fare as well as such an excellent theme demanded. I resolved therefore and promptly pledged myself to work out this right Royal theme more fully and then make it known to the world. This resolve has now been carried out as well as possible, and it has none other that this irreproachable intent, to glorify, if only in a small point, the fame of a monarch whose greatness and power, as in all the sciences of war and peace, so especially in music, everyone must admire and revere. I make bold to add this most humble request: may Your Majesty deign to dignify the present modest labor with a gracious acceptance, and continue to grant Your Majesty’s most august Royal grace to</p>
<p>Your Majesty’s most humble and obedient servant</p>
<p>Leipzig, July 7, 1747                                       The Author</p>
<p></li></ol>]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2010/01/enjoying-life-a-little-more/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/2-09-Musical-Offering-BWV-1079_-Canon-a-2.mp3" length="1253887" type="audio/mpeg" />
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/01-Thema-Regium-Traverso-Solo-Bach-1.mp3" length="842448" type="audio/mpeg" />
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/Ricercar-3.mp3" length="1673634" type="audio/mpeg" />
<enclosure url="http://oscarbonilla.com/wp-content/uploads/2010/01/Canon-a-2-07-invertido.mp3" length="1104920" type="audio/mpeg" />
		</item>
		<item>
		<title>Proof that P=NP</title>
		<link>http://oscarbonilla.com/2009/10/proof-that-pnp/</link>
		<comments>http://oscarbonilla.com/2009/10/proof-that-pnp/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 18:03:52 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Fun]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=312</guid>
		<description><![CDATA[So I was browsing Concrete Mathematics by Don Knuth et al, and I found a proof that P=NP for small N[1]. However if you make P=0, the size of N doesn't matter. So if P=0, then P = NP. Where is my money? Specifically for N=1. It's in the margin of the book]]></description>
			<content:encoded><![CDATA[<p>So I was browsing <a href="http://www.amazon.com/gp/product/0201558025?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0201558025">Concrete Mathematics</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=obonilswebsit-20&amp;l=as2&amp;o=1&amp;a=0201558025" border="0" alt="" width="1" height="1" /> by <a href="http://www-cs-faculty.stanford.edu/~knuth/">Don Knuth</a> et al, and I found <a href="http://www.wangcong.org/articles/cm_preface_en.html">a proof </a>that<a href="http://www.wangcong.org/articles/cm_preface_en.html"> </a><a href="http://cacm.acm.org/magazines/2009/9/38904-the-status-of-the-p-versus-np-problem/fulltext">P=NP</a> for small N[1]. However if you make P=0, the size of N doesn't matter. So if P=0, then P = NP. Where is my <a href="http://www.claymath.org/millennium/P_vs_NP/">money</a>?</p>
<ol class="footnotes"><li id="footnote_0_312" class="footnote">Specifically for N=1. It's in the margin of the book</li></ol>]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/10/proof-that-pnp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Two Envelopes Problem</title>
		<link>http://oscarbonilla.com/2009/10/the-two-envelopes-problem/</link>
		<comments>http://oscarbonilla.com/2009/10/the-two-envelopes-problem/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 05:13:54 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=280</guid>
		<description><![CDATA[A recent thread in reddit about the two envelopes problem reminded me of how unintuitive probabilities can be. There is a fundamental flaw with how the original post worded the problem: You and I both have envelopes filled with money. My envelope contains either double or half the amount of money that’s in yours. If you [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://www.reddit.com/r/math/comments/9qsa7/you_and_i_both_have_envelopes_filled_with_money/">recent thread in reddit</a> about <a href="http://en.wikipedia.org/wiki/Two_envelopes_problem">the two envelopes problem</a> reminded me of how unintuitive probabilities can be. There is a fundamental flaw with how <a href="http://www.philipbrocoum.com/?p=1032">the original post</a> worded the problem:</p>
<blockquote><p>You and I both have envelopes filled with money. My envelope contains either double or half the amount of money that’s in yours. If you want, I’m going to let you switch envelopes. Should you stay, switch, or does it not matter?</p></blockquote>
<p>Stop right there. Read that again. Does that make sense to you? See if you can set up the experiment in the real world. Grab two envelopes and some money. Take $100 and put them in an envelope, then, uh... what do you do with the other envelope? Put $50 in it? Put $200?</p>
<p>The original poster then went ahead and solved assuming probabilities of 1/2. But I'm not really choosing between two equally likely options. I don't know the probability distributions!</p>
<p>A better wording for the problem (or a different problem if you're pedantic) would be:</p>
<blockquote><p>There are two envelopes. One contains double the amount of money than the other. You choose one of them, I take the other. Now I offer you a choice between keeping your original choice or switching envelopes with me. Is it to your advantage to switch?</p></blockquote>
<p>The answer should be obvious, it doesn't matter.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/10/the-two-envelopes-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Monty Hall problem</title>
		<link>http://oscarbonilla.com/2009/05/the-monty-hall-problem/</link>
		<comments>http://oscarbonilla.com/2009/05/the-monty-hall-problem/#comments</comments>
		<pubDate>Tue, 05 May 2009 14:27:47 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://oscarbonilla.com/?p=179</guid>
		<description><![CDATA[After all the positive feedback I got from Visualizing Bayes' theorem, I thought I'd post my explanation of the Monty Hall problem. I was fascinated for a while with this problem because at first it doesn't seem to make any sense. And most of the explanations I've seen have a magic feel to them. I've [...]]]></description>
			<content:encoded><![CDATA[<p>After all the positive feedback I got from <a title="Visualizing Bayes' theorem" href="http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/" target="_blank">Visualizing Bayes' theorem</a>, I thought I'd post my explanation of the <a title="Monty Hall @ Wikipedia" href="http://en.wikipedia.org/wiki/Monty_Hall_problem" target="_blank">Monty Hall problem</a>. I was fascinated for a while with this problem because at first it doesn't seem to make any sense. And most of the explanations I've seen have a magic feel to them. I've even seen people with math backgrounds argue against the result.</p>
<p>I think the problem has to do with most of the explanations mixing two very different probability classes. But I'm getting ahead of myself.</p>
<h2>The Problem</h2>
<p>The problem statement (from Wikipedia) is:</p>
<blockquote><p>Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? (Schrock 1990) [1]</p></blockquote>
<p>If you are like most people, your gut feeling is going to be "it does not matter. There is a 50-50 chance that the car will be in the door I have already selected". Like most people, you would be wrong.</p>
<p>In order to solve this problem, you need to consider two very distinct pieces of information. One is "what state is the world in?", the other is "what events have occurred?". Let me elaborate.</p>
<h2>The States of the world</h2>
<p>When I deal with probabilities and get confused, I revert to counting. What are all the possible outcomes? What subset of those outcomes am I looking at? So let's look at all the posible states.</p>
<blockquote><p>Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats.</p></blockquote>
<p>Let's translate that to a simple diagram. We have three doors, let's label them A, B, and C. We also know that there is a car behind one of the doors, it can be behind door A, B, or C. So we have three possible configurations of the world:</p>
<p><img class="aligncenter size-full wp-image-205" title="picture-22" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-22.png" alt="picture-22" width="375" height="453" />The door with the car has been colored red. The possible states of the world are <em>Sa</em> (meaning the car is behind door A), <em>Sb</em> (car behind door B), and <em>Sc</em> (car behind door C).</p>
<p>Quick, what is the probability of the car being behind door A? Or to put it another way, what is the probability that the world is in state <em>Sa</em>? Note that these two questions are the same, but the latter reminds us of the possible states. It is easy then to see that</p>
<p><img class="aligncenter size-full wp-image-185" title="p-fig1" src="http://oscarbonilla.com/wp-content/uploads/2009/05/p-fig1.png" alt="p-fig1" width="107" height="133" />Now I'm going to ask you a very different question. Assume that instead of playing, you are observing your friend play the game. What is the probability that he will pick door A? Did you say 1/3? Of course you did, there are three doors and he must pick one. However, and this is really important, <strong>these probabilities are completely independent of the probabilities above!</strong></p>
<p>Think of it this way. If two doors had cars behind them instead of just one, would that change the number of states the world can be in? Would it change the probability of your friend choosing door A? What if all doors had cars? Now there is just a single state for the world, but your friend can still choose door A with 1/3 probability!</p>
<p>If we now say that A is the event of your friend opening door A, we can easily see that</p>
<p><img class="aligncenter size-full wp-image-186" title="p-fig2" src="http://oscarbonilla.com/wp-content/uploads/2009/05/p-fig2.png" alt="p-fig2" width="108" height="131" />which is just saying each door has an equal probability of being opened.</p>
<p>The trick to solving this problem is that you are dealing with two different classes of probabilities. One is the probability that the world is in a given state (a priori), the other is that a participant (you or Monty) chooses any given door. If you can keep these two classes of probabilities separate, you will be able to easily solve this problem.</p>
<p>Let's see what happens once you have made the choice. Let's assume you chose the door labeled A.</p>
<h2>What does Monty do?</h2>
<p>Monty is, of course, the host of the game show. And he is trying to screw you. He doesn't want you to get the car. He also happens to know where the car is, or in other words, he knows the state of the world. You on the other hand, are only guessing. You chose door A with probability 1/3, now he gets to choose a door. But there are only two doors left. He must choose either door B or door C.</p>
<p>So how does Monty choose? What is the probability that Monty will open the door labeled B? Here's what the world looks like to Monty:</p>
<p><img class="aligncenter size-full wp-image-206" title="picture-23" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-23.png" alt="picture-23" width="383" height="477" />Door A has been chosen, he must choose between doors B and C. Were he to choose randomly, each door would be equally probable,</p>
<p><img class="aligncenter size-full wp-image-194" title="picture-10" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-10.png" alt="picture-10" width="190" height="64" /></p>
<p>The little <em>m</em>'s are a reminder that this is Monty's choice, not your original choice. If you wanted to be pedantic you could add P(Am) = 0 since Monty can never choose door A (you chose that one).</p>
<p>But he knows better than to choose randomly, he knows whether we're in Sa, Sb, or Sc! How he chooses will depend on what the state of the world is. If we are in Sa, it doesn't matter what he chooses, he'll choose B or C with equal probability as neither has a car[2]. That is to say "given that we are in state Sa, Monty chooses door B with probability 1/2", in other words:</p>
<p><img class="aligncenter size-full wp-image-195" title="picture-12" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-12.png" alt="picture-12" width="137" height="61" />If we are in state Sb, Monty will <strong>never</strong> choose door B, that would be giving away the prize.</p>
<p><img class="aligncenter size-full wp-image-196" title="picture-14" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-14.png" alt="picture-14" width="127" height="39" />And finally, if we are in state Sc, Monty will <strong>always</strong> choose door B.</p>
<h2><img class="aligncenter size-full wp-image-197" title="picture-15" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-15.png" alt="picture-15" width="121" height="39" />Your turn</h2>
<p>And now it's your turn to make a decision. Do you stay with your original choice of door A? Or do you switch and choose door C?</p>
<p>First of all, does it matter? Is there any difference whether we switch or not? The answer is a resounding <strong>YES!</strong> Monty gave away information about the state of the world by choosing door B. We can use that information.</p>
<p>What we are really trying to figure out is this: "what configuration is the world in?" Monty knows, he used that information to choose door B. Now we have to ask ourselves, "given that Monty chose door B, what is the probability that the world is in state Sa versus the probability of the world being in state Sc?" Note that we have eliminated Sb because <em>Monty has already opened door B and there was no car!</em></p>
<p>Here is where we can apply Bayes' formula to get an answer:</p>
<p><img class="aligncenter size-full wp-image-198" title="picture-16" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-16.png" alt="picture-16" width="248" height="69" />and plugging in the values we have already computed:</p>
<p><img class="aligncenter size-full wp-image-199" title="picture-17" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-17.png" alt="picture-17" width="210" height="76" />Which means we have a 1/3 chance the car is behind our original choice of door A. Note that this 1/3 probability <em>is different than the original P(A) = 1/3 we had computed</em>. It ends up being the same number, but it is really a different probability!</p>
<p>What about the car being behind door C? What is the probability that we are in state Sc, given that Monty chose door B?</p>
<p><img class="aligncenter size-full wp-image-200" title="picture-18" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-18.png" alt="picture-18" width="255" height="62" />and plugging in the values we get:</p>
<p><img class="aligncenter size-full wp-image-202" title="picture-21" src="http://oscarbonilla.com/wp-content/uploads/2009/05/picture-21.png" alt="picture-21" width="210" height="67" />Which means we have a 2/3 chance the car is behind the <em>other</em> door (door C). Therefore we should switch.</p>
<h2>Does it matter if Monty knows?</h2>
<p>The only reason we managed to gain any information from Monty's choice of door B is that he <em>knows</em> the state of the world and acts differently depending on what state is the correct one. If Monty didn't know, he would have been choosing randomly between doors B and C and we would not have gained any information (except that Sb is not possible since there was no car behind door B).</p>
<p>If Monty <em>always</em> chooses door B when neither B nor C have the car, we would not have gained any information when he opens door B, but we would gain information if he opens door C (do you see why?).</p>
<p>Note that it is still to our advantage to switch doors, since in this case the probabilities for the states Sa and Sc are the same (1/2). And if we don't know whether Monty knows or not, we <em>might</em> get an advantage from switching.</p>
<ol class="footnotes"><li id="footnote_0_179" class="footnote"> If you are really pedantic, the mathematically correct definition of the problem is: "Suppose you’re on a game show and you’re given the choice of three doors. Behind one door is a car; behind the others, goats. The car and the goats were placed randomly behind the doors before the show. The rules of the game show are as follows: After you have chosen a door,the door remains closed for the time being. The game show host, Monty Hall, who knows what is behind the doors, now has to open one of the two remaining doors, and the door he opens must have a goat behind it. If both remaining doors have goats behind them, he chooses one randomly. After Monty Hall opens a door with a goat, he will ask you to decide whether you want to stay with your first choice or to switch to the last remaining door. Imagine that you chose Door 1 and the host opens Door 3, which has a goat. He then asks you “Do you want to switch to Door Number 2?” Is it to your advantage to change your choice? (<a title="The Psychology of the Monty Hall Problem: Discovering Psychological  Mechanisms for Solving a Tenacious Brain Teaser " href="http://www.usd.edu/~xtwang/Papers/MontyHallPaper.pdf" target="_blank">Krauss and Wang 2003:10</a>)"</li><li id="footnote_1_179" class="footnote"> This is important, if he doesn't choose either door randomly, you gain information asymmetrically. Keep reading. </li></ol>]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/05/the-monty-hall-problem/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Visualizing Bayes&#8217; theorem</title>
		<link>http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/</link>
		<comments>http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/#comments</comments>
		<pubDate>Fri, 01 May 2009 14:11:31 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=119</guid>
		<description><![CDATA[I recently came up with what I think is an intuitive way to explain Bayes' Theorem. I searched in google for a while and could not find any article that explains it in this particular way. Of course there's the wikipedia page, that long article by Yudkowsky, and a bunch of other explanations and tutorials. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came up with what I think is an intuitive way to explain Bayes' Theorem. I <a href="http://www.google.com/search?q=bayes+theorem+venn+diagram" target="_blank">searched in google</a> for a while and could not find any article that explains it in this particular way.</p>
<p>Of course there's the <a title="Bayes' theorem" href="http://en.wikipedia.org/wiki/Bayes'_theorem" target="_blank">wikipedia page</a>, that <a title="An Intuitive Explanation of Bayes' Theorem" href="http://yudkowsky.net/rational/bayes" target="_blank">long article</a> by Yudkowsky, and a bunch of other explanations and tutorials. But none of them have any pictures. So without further ado, and with all the chutzpah I can gather, here goes my explanation.</p>
<h2>Probabilities</h2>
<p>One of the easiest ways to understand probabilities is to think of them in terms of <a title="Venn diagram" href="http://en.wikipedia.org/wiki/Venn_Diagram" target="_blank">Venn Diagrams</a>. You basically have a <em>Universe</em> with all the possible outcomes (of an experiment for instance), and you are interested in some subset of them, namely some <em>event</em>. Say we are studying cancer, so we observe people and see whether they have cancer or not. If we take as our Universe all people participating in our study, then there are two possible outcomes for any particular individual, either he has cancer or not. We can then split our universe in two events: the event "people with cancer" (designated as <em>A</em>), and "people with no cancer" (or <em>~A</em>). We could build a diagram like this:</p>
<p><img class="aligncenter size-full wp-image-120" title="venn-a" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-a.png" alt="venn-a" width="390" height="340" />So what is the probability that a randomly chosen person has cancer? It is just the number of elements in <em>A</em> divided by the number of elements of <em>U</em> (the Universe). We denote the number of elements of <em>A</em> as <em>|A|</em>, and read it the <em>cardinality of A</em>. And define the probability of <em>A</em>, <em>P(A)</em>, as</p>
<p><img class="aligncenter size-full wp-image-149" title="eq01" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq01.png" alt="eq01" width="116" height="61" /></p>
<p>Since <em>A</em> can have at most the same number of elements as <em>U</em>, the probability <em>P(A)</em> can be at most one.</p>
<p>Good so far? Okay, let's add another event. Let's say there is a new screening test that is supposed to measure something. That test will be "positive" for some people, and "negative" for some other people. If we take the event B to mean "people for which the test is positive". We can create another diagram:</p>
<p><img class="aligncenter size-full wp-image-121" title="venn-b" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-b.png" alt="venn-b" width="390" height="340" />So what is the probability that the test will be "positive" for a randomly selected person? It would be the number of elements of <em>B</em> (cardinality of <em>B</em>, or <em>|B|</em>) divided by the number of elements of <em>U</em>, we call this <em>P(B)</em>, the probability of event <em>B</em> occurring.</p>
<p><img class="aligncenter size-full wp-image-150" title="eq02" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq02.png" alt="eq02" width="111" height="61" /></p>
<p>Note that so far, we have treated the two events in isolation. What happens if we put them together?</p>
<p><img class="aligncenter size-full wp-image-122" title="venn-last" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-last.png" alt="venn-last" width="390" height="340" />We can compute the probability of both events occurring (<em>AB</em> is a shorthand for <em>A∩B</em>) in the same way.</p>
<p><img class="aligncenter size-full wp-image-153" title="eq04" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq04.png" alt="eq04" width="153" height="63" /></p>
<p>But this is where it starts to get interesting. What can we read from the diagram above?</p>
<p>We are dealing with an entire Universe (all people), the event <em>A</em> (people with cancer), and the event <em>B</em> (people for whom the test is positive). There is also an overlap now, namely the event <em>AB</em> which we can read as "people with cancer and with a positive test result". There is also the event <em>B - AB</em> or "people without cancer and with a positive test result", and the event <em>A - AB</em> or "people with cancer and with a negative test result".</p>
<p>Now, the question we'd like answered is "given that the test is positive for a randomly selected individual, what is the probability that said individual has cancer?". In terms of our Venn diagram, that translates to "given that we are in region <em>B</em>, what is the probability that we are in region <em>AB</em>?" or stated another way "if we make  region <em>B</em> our new Universe, what is the probability of <em>A</em>?".  The notation for this is <em>P(A|B)</em> and it is  read "the probability of A given B".</p>
<p>So what is it? Well, it should be</p>
<p><img class="aligncenter size-full wp-image-151" title="eq03" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq03.png" alt="eq03" width="152" height="58" />And if we divide both the numerator and the denominator by <em>|U|</em></p>
<p><em><img class="aligncenter size-full wp-image-155" title="eq051" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq051.png" alt="eq051" width="159" height="79" /></em>we can rewrite it using the previously derived equations as</p>
<p><img class="aligncenter size-full wp-image-131" title="bayes-eq1" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq1.png" alt="bayes-eq1" width="178" height="54" />What we've effectively done is change the Universe from <em>U</em> (all people), to <em>B</em> (people for whom the test is positive), but we are still dealing with probabilities defined in <em>U</em>.</p>
<p><img class="aligncenter size-full wp-image-156" title="venn-justb" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/venn-justb.png" alt="venn-justb" width="380" height="381" /></p>
<p>Now let's ask the converse question "given that a randomly selected individual has cancer (event <em>A</em>), what is the probability that the test is positive for that individual (event <em>AB</em>)?". It's easy to see that it is</p>
<p><img class="aligncenter size-full wp-image-132" title="bayes-eq2" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq2.png" alt="bayes-eq2" width="168" height="60" />Now we have everything we need to derive Bayes'  theorem, putting those two equations together we get</p>
<p><img class="aligncenter size-full wp-image-133" title="bayes-eq3" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq3.png" alt="bayes-eq3" width="240" height="28" />which is to say <em>P(AB)</em> is the same whether you're looking at it from the point of view of <em>A</em> or <em>B</em>, and finally</p>
<p><img class="aligncenter size-full wp-image-134" title="bayes-eq4" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/bayes-eq4.png" alt="bayes-eq4" width="213" height="58" /></p>
<p>Which is Bayes' theorem. I have found that this Venn diagram method lets me re-derive Bayes' theorem at any time without needing to memorize it. It also makes it easier to apply it.</p>
<h2>Example</h2>
<p>Take the following example from Yudowsky:</p>
<blockquote><p>1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammograms. 9.6% of women without breast cancer will also get positive mammograms. A woman in this age group had a positive mammography in a routine screening. What is the probability that she actually has breast cancer?</p></blockquote>
<p>First of all, let's consider the women with cancer</p>
<p><img class="aligncenter size-full wp-image-142" title="example14" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/example14.png" alt="example14" width="331" height="332" />Now add the women with positive mammograms, note that we need to cover 80% of the area of event A and 9.6% of the area outside of event A.</p>
<p><img class="aligncenter size-full wp-image-143" title="example21" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/example21.png" alt="example21" width="320" height="321" />It is clear from the diagram that if we restrict our universe to <em>B</em> (women with positive mammograms), only a small percentage actually have cancer.  According to the article, most doctors guessed that the answer to the question was around 80%, which is clearly impossible looking at the diagram!</p>
<p>Note that the efficacy of the test is given from the context of <em>A</em>, "80% of women with breast cancer will get positive mamograms". This can be interpreted as "restricting the universe to just <em>A</em>, what is the probability of <em>B</em>?" or in other words <em>P(B|A)</em>.</p>
<p>Even without an exact Venn diagram, visualizing the diagram can help us apply Bayes' theorem:</p>
<ul>
<li>1% of women in the group have breast cancer → <em>P(A)</em> = 0.01</li>
<li>80% of those women get a positive mammogram, and 9.6% of the women without breast cancer get a positive mammogram too →<em> P(B)</em> = 0.8 <em>P(A)</em> + 0.096 (1 - <em>P(A)</em>) = 0.008 + 0.09504 = 0.10304</li>
<li>we can get <em>P(B|A)</em> straight from the problem statement, remember 80% of women with breast cancer get a positive mammogram → <em>P(B|A)</em> = 0.8</li>
</ul>
<p>Now let's plug those values into Bayes' theorem</p>
<p><img class="aligncenter size-full wp-image-162" title="eq06" src="http://blog.oscarbonilla.com/wp-content/uploads/2009/04/eq06.png" alt="eq06" width="182" height="59" />which is 0.0776 or about a 7.8% chance of actually having breast cancer given a positive mammogram.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/feed/</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>Is that possible?</title>
		<link>http://oscarbonilla.com/2008/12/is-that-possible/</link>
		<comments>http://oscarbonilla.com/2008/12/is-that-possible/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 05:59:34 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=95</guid>
		<description><![CDATA[I normally read the good math bad math blog, where Mark Chu-Carroll debunks crackpots that try to hide their crazyness behind bad math. A while ago, he posted an article called "Why Math?", where he discusses how math allows you to "without ambiguity, prove that something is true or false". While I agree with Mark, I [...]]]></description>
			<content:encoded><![CDATA[<p>I normally read the <a href="http://scienceblogs.com/goodmath/">good math bad math</a> blog, where Mark Chu-Carroll debunks crackpots that try to hide their crazyness behind bad math. A while ago, he posted an article called "<a href="http://scienceblogs.com/goodmath/2008/12/why_math.php">Why Math?</a>", where he discusses how math allows you to "without ambiguity, prove that something is true or false".</p>
<p>While I agree with Mark, I think it's not completely clear from his post the importance of math's role in deciding what to believe.</p>
<p>One <a href="http://scienceblogs.com/goodmath/2008/12/why_math.php#comment-1255771">comment</a> in particular inspired me to write this post.</p>
<blockquote><p>Statements of the form "___ is impossible." strike me as deeply unscientific and dogmatic.</p></blockquote>
<p>See, math is a formal system for thinking logically. The heart of math lies in being able to prove things from assumptions. So in that sense, if the math is done right, Mark's remark "without ambiguity, prove that something is true or false" is spot on.</p>
<p>However, the assumptions need to be true or your whole argument is invalid, no matter how good the math is.</p>
<p>But going back to "___ is impossible", I think there are different levels of "impossible" that we need to be concerned about.</p>
<p>We can classify impossible things in three categories: logically impossible, physically impossible, and technologically impossible.</p>
<p><strong>The logically impossible</strong></p>
<p>To understand the first category, we need to resort to some philosophical bullshit. Back in the day when people didn't have <a href="http://www.reddit.com/">reddit</a> and used to wander around in their togas thinking whether we could think at all, the great <a href="http://en.wikipedia.org/wiki/Aristotle">Aristotle</a> proposed what he called his <a href="http://en.wikipedia.org/wiki/Laws_of_thought#Aristotle">three laws of thought</a>. These form the basis of logic and if you think about them, they make perfect sense. The first law is called the <a href="http://en.wikipedia.org/wiki/Law_of_identity">law of identity</a>, and it just says an object is equal to itself. The second law is the<a href="http://en.wikipedia.org/wiki/Law_of_noncontradiction"> law of noncontradiction</a> and it says that nothing can both have a property and not have it at the same time. The third law is the <a href="http://en.wikipedia.org/wiki/Law_of_excluded_middle">law of excluded middles</a> and it says that objects either have a certain property or they don't</p>
<p>I particularly like <a href="http://en.wikipedia.org/wiki/Avicenna">Avicena</a>'s description of the law of noncontradiction:</p>
<blockquote><p>Anyone who denies the law of non-contradiction should be beaten and burned until he admits that to be beaten is not the same as not to be beaten, and to be burned is not the same as not to be burned.</p></blockquote>
<p>This is where math helps. Math allows you to follow arguments to their logical conclusion and either prove or disprove them. It's formalized thinking, and it's full of little shortcuts and notation that allows you to be efficient in reaching your conclusions and in communicating those conclusions to others.</p>
<p>If you find something to be logically impossible, you've found a real impossibility. No way around it. Time travel is the best example of a logical impossibility. If you travel back in time to a place (and time) you have never been before, you would violate the law of noncontradiction (you were both there and not there). That's why sophisticated science fiction writers like <a href="http://en.wikipedia.org/wiki/Michael_Crichton">Michael Crichton</a> always have the travelers go to a <a href="http://www.amazon.com/gp/product/0345468260?ie=UTF8&amp;tag=obonilswebsit-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0345468260">parallel universe</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=obonilswebsit-20&amp;l=as2&amp;o=1&amp;a=0345468260" border="0" alt="" width="1" height="1" />.</p>
<p><strong>The physically imposible</strong></p>
<p>Some things however, are not logically impossible, but they violate the laws of physics. This is slightly harder to detect, since our understanding of the laws of physics changes and it has been known to be <a href="http://en.wikipedia.org/wiki/Luminiferous_aether">completely wrong</a>. But if you claim that something that violates the laws of physics is possible, the burden is on you to convince us that the laws of physics are wrong. Not an easy feat!</p>
<p>One example of this would be the claim that you can<a href="http://en.wikipedia.org/wiki/Faster_than_light"> travel faster than light</a>. Unless you're willing to debunk <a href="http://en.wikipedia.org/wiki/Henri_Poincaré">Poincaré</a>'s <a href="http://www.mathpages.com/rr/s8-08/8-08.htm">theory of relativity</a>, you're going to have trouble having anyone believe you.</p>
<p><strong>The technologically impossible</strong></p>
<p>Other things don't violate either the laws of logic (math) or the laws of physics, yet they are beyond our current reach. This is the weakest level of impossibility because it could be just a matter of time before we get there. Almost all current technology would have fallen in this category only a century ago. Just imagine trying to explain the Internet and iPhones to people of the 1800's, they would have certainly shouted "Witchery!".</p>
<p>In conclusion, statements of the form "___ is impossible" don't need to be unscientific and dogmatic.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/12/is-that-possible/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Simple Guide to Complexity Theory</title>
		<link>http://oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/</link>
		<comments>http://oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 05:09:55 +0000</pubDate>
		<dc:creator>ob</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://blog.oscarbonilla.com/?p=76</guid>
		<description><![CDATA[After reading Jeff's terribly misguided post about NP-completeness I thought to myself: "If Jeff, who seems to be completely clueless about complexity theory, can write a blog post about it then so can I." So without further ado, here's ob's complex guide to simplifying complexity theory. First of all let's get the definitions out of [...]]]></description>
			<content:encoded><![CDATA[<p>After reading <a href="http://www.codinghorror.com/blog/archives/001187.html">Jeff's terribly misguided post about NP-completeness</a> I thought to myself: "If Jeff, who seems to be completely clueless about complexity theory, can write a blog post about it then so can I."</p>
<p>So without further ado, here's ob's complex guide to simplifying <a title="complexity theory" href="http://en.wikipedia.org/wiki/Computational_complexity_theory" target="_blank">complexity theory</a>.</p>
<p>First of all let's get the definitions out of the way.</p>
<p><strong>Turing machine:</strong> An idealized computer, with infinite memor<span style="text-decoration: line-through;">y, <span style="text-decoration: line-through;">an infinitely fast cpu, and unlimited bandwidth</span></span>. It's a mathematical model of computer so it can kick your Core 2 Duo's sorry little ass faster than you can say <em>Pentium</em>. <em>(</em><strong><em>update:</em></strong><em> I originally wanted to make the point that bandwidth and cpu speed are irrelevant, but it seems to have confused more than clarified.)</em></p>
<p><strong>Problem:</strong> In complexity theory, a problem is really a decision problem. It has a simple yes/no answer. <span style="text-decoration: line-through;">You don't ask "take this list and sort it and print the last ten items" that's not a decision problem. You do ask "does this program, given this input, produce the last ten items of the sorted input?".</span></p>
<p><em>(<strong>update:</strong> Although the sort problem as outlined here would be a valid decision problem, it is confusing since just changing my "last ten items" to "last C items" where C is a function of n would make it not be a decision problem. Better to use some other example, like "<a href="http://en.wikipedia.org/wiki/Primality_testing">is the number given prime?</a>")</em></p>
<p><strong><em>n</em>:</strong> Size of the input for the turing machine. E.g. if your turing machine is sorting strings, like in the example above, <em>n</em> is the number of symbols that it takes as input.</p>
<p><strong>T(<em>n</em>):</strong> Number of steps (i.e. instructions) that a turing machine must execute to solve a problem with input of size <em>n</em>.</p>
<p><strong>Polynomial Time:</strong> When T(<em>n</em>) can be expressed as an equation of <em>n</em>, and possibly some constants, using only addition, subtraction, multiplication, and constant non-negative whole number exponents. E.g. n² is a polynomial while 2ⁿ is not.</p>
<p><strong>Non-deterministic turing machine:</strong> A turing machine that can, at every branch point, take all possible branches in parallel. We call this <em>guessing</em> the optimal answer because, since the turing machine takes all branches, it must take the optimal branch too. If any of the parallel turing machines finds an answer, the non-deterministic turing machine stops and gives that answer (this means that it's ok for some branches to never end).</p>
<p>So take your already idealized computer from above and make it able to reproduce itself on every branch point. I.e. it can follow all possible decisions in parallel.</p>
<p><strong>P:</strong> The class of problems that can be solved by a turing machine in polynomial time.</p>
<p><strong>NP:</strong> The class of problems that can be solved by a non-deterministic turing machine in polynomial time.</p>
<p><strong>Reducing a problem to another:</strong> Imagine you have two problems, <em>P1</em> and <em>P2</em>. You know something about <em>P1</em> (e.g. that it belongs to <strong>NP</strong>). Now you want to prove some property of <em>P2</em>, for instance, that it belongs to <strong>NP</strong> as well.</p>
<p><span style="text-decoration: line-through;">One technique is to show that if we could solve </span><em><span style="text-decoration: line-through;">P2</span></em><span style="text-decoration: line-through;"> in polynomial time (i.e. </span><em><span style="text-decoration: line-through;">P2</span></em><span style="text-decoration: line-through;"> belongs to </span><strong><span style="text-decoration: line-through;">P</span></strong><span style="text-decoration: line-through;">), we could use that answer to solve </span><em><span style="text-decoration: line-through;">P1</span></em><span style="text-decoration: line-through;"> in polynomial time. This would mean that </span><em><span style="text-decoration: line-through;">P1</span></em><span style="text-decoration: line-through;"> belongs to </span><strong><span style="text-decoration: line-through;">P</span></strong><span style="text-decoration: line-through;"> which is a contradiction. This technique is called </span><em><span style="text-decoration: line-through;">reductio ad absurdum</span></em><span style="text-decoration: line-through;">.</span> <em>(<strong>update: </strong>I completely botched this and commenter Bibi correctly called me on it. Here's an attempt to clarify a reduction: if you want to solve an instance of P2, you convert it to an instance of P1, and then solve P1 to get an answer. Thus, you've reduced P2 to P1. How's that?)</em></p>
<p><strong>NP-complete:</strong> We say a problem is NP-complete if it satisfies two properties: 1) it belongs to <strong>NP</strong>, and 2) every other problem that belogs to <strong>NP</strong> can be reduced, in polynomial time, to it.</p>
<p>This means that if we come up with a solution for an NP-complete problem that runs in polynomial time in a deterministic turing machine (i.e. belongs to <strong>P</strong>), any other problem in <strong>NP</strong> can be solved in polynomial time by first reducing it (again, in polynomial time) to this problem, and using our solution. We would have proved that <strong>P = NP</strong> and we would have also won (pinky to corner of mouth) <a href="http://www.claymath.org/millennium/P_vs_NP/">one million dollars</a>.</p>
<p><strong>NP-hard:</strong> A problem <em>P1</em>, that is so hard, that even though we can prove number two above, we can't prove number one. This means we know <em>P1</em> to be just as hard as anything in <strong>NP</strong> and possibly harder, but <em>we don't know</em> if <em>P1</em> is in <strong>NP</strong> or not. <em>P1</em> is very likely to require exponential time.</p>
<p><strong><em>(update: <span style="font-weight: normal;">I stand by my definition of NP-hard. Although not being able to prove #1 is a sufficient condition, it is not necessary. All problems in P are in NP, and yet we call them P, not NP. Thus, even if all problems that are NP-complete are also NP-hard, it's uninteresting to call an NP-complete problem NP-hard. The point of calling a problem NP-hard is that, it's really hard! Even if it turned out that P = NP, an NP-hard problem might still be hard!)</span></em></strong></p>
<p>So there you have it, go impress your friends. I hear that "hey, baby! your love is NP-hard to get" is a very successful pickup line at pubs around M.I.T.</p>
]]></content:encoded>
			<wfw:commentRss>http://oscarbonilla.com/2008/11/simple-guide-to-complexity-theory/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
