Two bit experiment
July 24, 2010 by Tobi · Leave a Comment
Edit: I apologize for not posting the Friday find the Fallacy for the last two fridays, I’ve been very busy with school and work. For now here is an experiment that explores the binomial probability distribution.
In my probability class we derived a discrete probability function called the binomial distribution. It was interesting to see that we could do it with combinatorics alone. When I took my first statistics/probability course several years ago, we were just handed a formula and told to work through the problems, with no explanation of why the formula was the way it was.
I’m going to run some experiments that are supposedly modeled by this distribution and see how the results compare to the theory, but first, I have to explain what it is. The binomial distribution rests on these assumptions:
- There are a fixed number of trials, denoted n
- A trial can only have two possible outcomes, denoted S or F for “success” or “failure” (no value judgement is imposed, it’s just a convention we have adopted, probably from the gambling origins of probability)
- The probability of an event we call a “success” is constant from trial to trial, denoted p
- The probabilities of all the trials are independent, meaning that they don’t affect one another
These assumptions are sufficient for us to derive the distribution, then we can run some tests using our shiny new formula. To start, the assumption of independence is important. If I flip a fair coin, the probability of getting two heads (2 successes) is (0.5)(0.5) = 0.25, or 25%. I calculated this assuming that the outcome of the second toss is independent of the outcome of the first toss, that is independence. If there are two independent events with probabilities p1 and p2, then the probability that both events will occur is just the product of p1 and p2.
The notation means “the number of ways of selecting x items from a set of n things”. Given n trials in an experiment, the probability of x successes is
. This is because there are
ways of selecting x successes and (n-x) failures.
This is not a full derivation, but we don’t have time for that know, we are here to do numerical experiments and see if this model works or not. Here’s what the distribution looks like:
This is what the binomial distribution looks like with n(number of trials) = 20, p(probability of heads) = .5, and 1<x<n. What it represents is the likelihood that out of 20 trials, x (the horizontal axis) number of heads occur. The distribution peaks at 10, which makes sense since we are assuming a fair coin.
This follows from the assumptions, now let’s see how close it is when we run some coin toss simulations. To simulate a coin toss, we generate a random number 1 or 0, for heads or tails, respectively. I’ll be running the experiment in mathematica, so to make things less dry, I mapped the image of a quarter head to a one and tails to a zero.
Here is the setup:
In the above example, 65% of the coin tosses were heads, the next thing I did was run this trial 10,000 times and observe the resulting distribution. The algorithm is simple, for each trial, generate 20 “coin tosses” and then count the number of heads, append that to a list, and then repeat 10,000 times. Taking the histogram of the resulting experiment matches the prediction well:
The boxes of the histogram look shifted to the right, but that is because the left endpoint of the base of the box represents the number of heads. The vertical axis represents the probability that that number of heads will be observed in a trial of 20 fair coin tosses.
Overall I’m convinced that the binomial distribution is a good model for this kind of experiment.
Friday Find the Fallacy
July 10, 2010 by Tobi · 2 Comments
Alice and Bill got into an argument about probability after Alice accused Bill of being innumerate for his statement about the weather (see last week). Alice maintained that the probability was 75% whereas Bob claimed it was 100%. After a lengthy debate, Alice conceded that there wasn’t enough information about how related the events on Sunday and Saturday were to really say. She concluded that it could be anything in the world.
What is wrong with this conclusion?
About last week’s post, it turns out that there are situations in which Bob would be right, namely, ones where the probability that it will rain on both Saturday and Sunday is 0%. It was pointed out by a reader that I assumed that these events were independent, so now that I’ve been corrected, try to see if you can figure out Alice’s mistake.
Friday Find the Fallacy
July 3, 2010 by Tobi · 15 Comments
This is the first Friday Find the Fallacy, a weekly puzzle where all you perspicacious readers try to identify what’s wrong with a particular piece of reasoning. I’ll post a tidbit that demonstrates a logical fallacy, and then in the comments, post what you think the fallacy is (double points if you know the latin name!).
Alice and Bill are sitting on the couch watching the weather channel and the weatherman announces that on both Saturday and Sunday there will be a 50% chance of rain. Bill turns to Alice and says “looks like that means there will be 100% chance of rain this weekend!”
Next week I’ll post the answer along with a new fallacy puzzle, stay tuned!
Something seems wrong here
The fact that these devices cost the same is preposterous.
How I learned to stop worrying and love statistics
April 17, 2010 by Tobi · 2 Comments
After becoming more interested in mathematics as a discipline and taking more math classes, I started to develop an unwarranted bias against approximation and application. My position was that all that was valuable and worth knowing were logically necessary truths, I exalted mathematical proof, and regarded it as the golden standard of knowledge.
Not being a neo-Platonist, I couldn’t convince myself of the reality of the objects and structures I was studying. I was always aware that sets and numbers were not ontologically on par with matter and energy, so I developed an angst about the value of my education. Was I wasting time studying the finer details of objects that didn’t exist? Was I just as bad as theologians and cryptozoologists who study angels and psychic bigfoot?
After studying formal logic in depth I realized that the truth of the proof is dependent upon the axioms you choose. Axioms are statements that are regarded as true. That is, axioms are arbitrary. Some axioms are chosen because they are useful, some because they seem obvious. An example of a useful axiom is the parallel postulate in Euclidean geometry, without which we wouldn’t have the Pythagorean theorem.
To make things sketchier, after reading Douglas Hofstadter’s “Gödel, Escher, Bach”, I learned of Gödel’s incompleteness theorem, which, in a nutshell demonstrates the limits of formal systems with a fixed set of axioms. Informally, for any formal system it was possible to formulate a statement that is true but not provable. This led to the insight that truth and provability were not the same thing, and also, that there is no single formal system to encompass all mathematical truths. What then was the role of proof in mathematics? What were proofs anyway?
Proofs boil down to what mathematicians agree is true. This is not to devalue the effort, the results of mathematical proof are useful because we can be certain they are true if the axioms are reliable. If we accept the axioms as true, then all the theorems derived from those axioms are also true.
I was studying imaginary structures, not the real world. The only upside was that it was fun and I could be absolutely certain that what I was saying about these imaginary structures was true. This was not very satisfying, since I had many questions about the world that could never be addressed through pure mathematics.
Since the things I could be certain about were not real, I couldn’t content myself with using proof as the basis of my worldview. I started taking physics classes and developed a sense of how valuable approximate knowledge is. My high of having absolute knowledge wore off, and I came out of the trance with a huge advantage when I got around to applying the mathematics that I had picked up.
Albert Einstein was right on when he said “As far as the laws of mathematics refer to reality, they are not certain, as far as they are certain, they do not refer to reality.”
So I was left with coming up with a basis for my view of the world. I needed a way of taming uncertainty, so I started to soften up to approximation, I steered toward applied math and statistics.
Statistics is the science of uncertainty, it allows us to know how certain we can be about a claim given a set of data. The golden standard in statistics and in science is evidence, not proof. My initial unease about uncertainty and approximate knowledge was due to a fascination I had with the ironclad feel of a proof. This couldn’t last, because even proof boils down to assumptions (axioms), and insofar as those assumptions are about the world, we can never really know whether they apply to the world.
I’ve decided to study science and apply the mathematics that I learned to questions about real things, not psychic bigfoot.
