Sunday, June 10, 2012

Trashy Game Theory

Of the trashy TV that I watch, I think that Paradise Hotel has got to be the trashiest.  The first week there were 6 girls and 5 guys on the show.  In order to continue their stay at the Paradise Hotel, the girls would each pick a guy, one by one, to be her roommate for the week.  One pair would then have a "third wheel" (since the girls outnumber the guys), and the guy would then choose which girl he would keep as his roommate.

Now, since I'm a complete nerd, I stated working out odds and percentages and maximizing how to play the game.  Game theory has to do with making decisions based on the decisions of other people.  It's incredibly useful and valuable, so let's take a second to break it down in a more simple example.  Let's say there are two competing coffee shop companies, Staribou Coffee and Carbucks Coffee.


Both are national chains and are looking to expand their business in either New York City or Oklahoma City.  Since NYC real estate is much more expensive than OKC real estate, each chain could either open one shop in NYC or 2 shops in OKC.  Because these are two competing businesses, if both choose to open shops in the same cities, neither company will turn a profit.  How does each business choose where to open the new shops?

We probably need a little bit more information, but each shop is going to use game theory.  If you're in Staribou's position, the most important thing is to not open shops in the same city as Carbucks.  So you're going to put yourself in Carbucks' position.  And you may ask yourself, "well, how did I get here? what would Carbucks do?  I'm going to open my shops where they won't open shops."  Well, Carbucks is doing exactly the same thing, and putting itself into Staribou's position, quoting Talking Heads....Game Theory tends to get very circular ;)

Let's get back to the Game of Paradise Hotel:

In the Game of Paradise Hotel, you either put out, or you go home.  I told you it was trashy!
The first girl and the last girl are trivial choices.  The first girl has open season, and the last girl will be forced to (we'll see why she's forced to in a second) double up on a man.  Let's work on the second girl.  She has a choice; either she can double up on the first girl's choice, or she can pick a new hunk.  IF she doubles up, then she has a fifty percent chance of going home, depending on who the guy chooses (every other girl will choose an open man because that is the choice that gives a one hundred percent chance of staying).  IF she does not, and picks a new man, then we need to find the odds of another girl choosing the same man.  Recursion, ho!

3RD GIRL: We've assumed that the 2nd girl picked a new man.  There are now 3 open men.  She can either pick a taken man (50%) or pick a new man.  Recursion, ho!

4TH GIRL: Assuming 3rd girl picked a new man.  2 open men.  She can either pick a taken man (50%) or pick a new man.  Recursion, ho!

5TH GIRL: Assuming 4th girl picked a new man.  1 open man.  If she picks a taken man, she has a 50% chance of going home.  Since there's one girl to go after her, she has a .2*.5=10% chance of going home if she picks the open man.  The 5th girl will, naturally, pick the last man standing.  Ho, recursion!

4TH GIRL:  OK, how we know what the 5th girl's choice is.  That means that the 6th girl is the only girl that can challenge you for your man.  10% chance of going home if she picks a new man.  The 4th girl will pick an single man.  Ho, recursion!

3RD GIRL:  Now we know what 4th and 5th girls' choices are!  They're going to pick new men!  10% chance of going home for picking a single man, so the 3rd girl will pick a single man.  Ho, recursion!

2ND GIRL: That brings us to the end of the recursive argument.  Now we know what each girl after us is going to do; they're picking new men.  So, to recap, there's a 50% chance of going home if she doubles up.  Since each girl after us is picking a new man, that means there's a 10% chance that, if you pick a new man, the 6th girl will 1) choose your man AND 2) your man chooses girl #6 over you.  Therefore, the 2nd girl will choose a new man.

Thus, each girl will choose a new man (unless she thinks that a particular man has more than a 90% chance of picking her over the other woman).  The 6th girl must be doubled up, and thus has a trivial decision (any man she picks will result in a 50% chance to go home).

Due to the nature of the game, she has a 50% chance of going home.  Every other girl has a 10% chance of going home.
I pity the girl who chooses last!


Tuesday, June 5, 2012

US Space Program

It's been almost a year since the last shuttle mission.  I've spent a lot of time (time which probably is normally better spent grading or lesson planning...) thinking about the American space program, reasons for its being there, reasons for it not to be there, etc.  Although NASA represents a very small percentage of the federal budget, and has for a majority of the organization's lifetime, the question remains: is space exploration and research a worthwhile use of our money?

In preparation for November's election, I've been trying to figure out, exactly, what my political stance is.  Take the budget for example.  It's easy to say "we need to raise taxes and cut spending in order to reduce the deficit."  However, it's much harder to try and figure out where to cut that spending.  The government provides many services for the people; where do I draw the line to start classifying projects as unnecessary spending?

For example, I think Planned Parenthood is a wonderful program.  It provides safe, easy, and affordable medical services, and contrary to popular Republican belief, does much much more than birth control and abortions.  Could we, as a society, afford to cut it?  Probably.  It's not, strictly speaking, necessary for our lives.  Just the same, I think I'd like to keep it around.

Let's look back at NASA.  They've made some incredible inventions, innovations, and brought technology leaps and bounds within the course of about 60 years.  They are responsible for inspiring and realizing the genre of science fiction.  In turn, the scientists took the best tech that came from sci fi and turned it into reality.  NASA has improved our understanding of the universe and took some of the first steps to exploring that universe.  And yet, somehow I have a sinking feeling that their well has run dry; that space has nothing left to offer.  I sincerely hope I'm wrong, but with this feeling I find it hard to justify spending federal tax dollars to fund NASA.

I think what I need is a set of rules for what the government should spend its money on.  Now, the Constitution has very specific things that it says the federal government is responsible for.  While that will drastically reduce spending, it will also entirely cut out funding for things like Planned Parenthood, NASA, the NSF, and public education, just to name a few.  And I like those things.  They're badass.

I'll leave you with what I think is one of the most powerful clips NASA has made.  It's a view of the Tail Service Masts at the base of a Saturn V rocket.  Try to keep in mind the scale; I could easily drive a truck into one of the five F-1 engines at the base of the rocket.  Each of the TSMs is about 9.5 meters high, and the Saturn V experiences an initial acceleration of about 12 meters per second per second.  Look at how fast the mechanism works to get the TSM clear of the vehicle and safe from the engine exhaust.  It's incredible how many little details there were to get 12 men on the moon.

Anyway.

 

Thursday, May 31, 2012

Fair Dice

I came upon this really intriguing question here in the 11th Company forums.  The gist of the question is that if he "knows" his dice have different rolling percentages than average, is it fair to use them?  And when does it cross the line into cheating?  A very interesting question, indeed.  However, with the power of STATISTICS (fanfare), I believe the answer can become quite clear.

When you look at the data, it appears to be fairly irregular.  You should expect around 16-17% for each face of the die, and with one of his sets, he gets a percentage of 22%!  I won't get too much into the meat and potatoes of the statistics here, but I took the original poster's data and ran it through a Chi-square goodness of fit test (By the way, for all you haters, this sample size is plenty big).  Assuming the dice are fair to begin with (a standard assumption with any hypothesis test), there is a 12.13% chance that you would get similar results or a more extreme result.  This means that I have (roughly....) a 10% chance of any face showing up 22% of the time or more!  It's only for very large sample sizes (read: infinite sample sizes), where you expect to have exactly 16.67% proportions for each face of the die.

Just for fun, I did another goodness of fit test with the OP's second set of dice.  Instead of asking "what's the probability that I get a more extreme result" like I did last time, I asked "what's the probability of getting a more consistent result."  Our assumption that the dice are fair remain the same.  Guess what?  The probability that we get this level of a result or a more consistent result (that is, proportions closer to 16.67%) is only 8.78%.  It's very very rare to take a finite sample size and get perfect proportions.

To illustrate this point, I'd like to bring up a childhood anecdote.  On my TI-83 plus from high school, I got an application called "probability simulator."  When I was bored in class, I would call up this application and simulations.  Simulations with thousands of trials.  Despite this, I never got a perfectly uniform bar graph.  Why?  Because probabilities address only long-term proportions.  And long term does not mean a thousand trials.  It doesn't even mean a million trials.  Long term means an infinite number of trails.

Click to embiggen
That being said, let's talk about the cheating aspect of the question.  At what point would I consider this cheating?  My answer if very simple.  You're cheating if you brought unfair dice, knowingly or not.  If you make a decision based on an series of test rolls, you're probably just fooling yourself; there's nothing spectacularly unusual about the first set of dice.  And let's say that you engineered your dice so that sixes were rolled 20% of the time instead of 16.67%.  On average (that is, in the long-term), that means that you get an extra four sixes out of every hundred rolls of the die.  I don't believe that's enough of a chance to ruin a game.

Can you test for this?  Of course not!  That would be silly!  Nearly as silly as this xkcd.  (the "p" in the comic is the probability that you saw an increased chance of acne assuming that jelly beans are not correlated with acne.  .05 means 5%.   There.  Now you can read it and understand!).

Of course, the joke here is that they tested 20 different jelly bean colors and one of those tests was significant.  1/20 is 5%.  It's bound to happen that, if you do an experiment enough, you get the significant results.  That's the nature of the game.  And this would directly apply to a tournament testing dice.  If I have 64 people in a tournament and I'm testing at a 5% level, I would, on average, throw out 3 of them for having unfair dice, even if they had fair dice.


There's one last topic I'd like to address that was brought up in the thread.  That's the idea of "precision dice."  Why do people sell "precisions dice" if they're just as good as normal, cheapo dice?  Well, probably because people want to buy into it.  It's been shown time after time that tap water is at least as safe as bottled water (and/or that bottled water comes from a city's municipal water supply....in layman's terms...tap water), yet the bottled water industry is wildly successful.  It's all about how you sell your product, and Penn and Teller do a marvelous job of showing it.


Friday, May 4, 2012

Gay Rights and General Thoughts

I stumbled across the upcoming proposal to the North Carolina constitution today, which prompted an extended chain of videos and blogs, ending in some of my favorite anti-atheist videos and a search as to why the Christians are against gay marriage (from a legal and secular standpoint).

Peanut Butter depends on the lack of evolution!
I found a story of a man named David Parker who's son was exposed to the "gay agenda" in Kindergarten, where teachers were talking about families with two dads, same-sex couples, and so on.  David decided he didn't want his son exposed to this "radical" thinking, marched into the school to get some change happening, didn't get it, and was subsequently arrested for trespassing when he refused to leave.
Well then I'll just live in this tree school until I get what I want!
At first, the school's actions surprised me.  Normally we try to appease parents, and it's not unheard of to have parents request and grant requests for their children to "opt out" of evolution, much like David wanted to opt his child out of the gay curriculum (no pun).  The reason why David's request wasn't granted was because this is a basic civil rights issue.  The Catholic Church (at least in my experience) seeks to dehumanize those with different sexual identities.  I can't count the number of sermons I sat through with the priest professing the sins of being gay, the eternal hellfire which awaited them, and how gay people embodied the spirit of Lucifer himself, only to take everything back by saying, "If you are gay, we can save you!"

It got me to wondering what schools were like around the time of Brown v. Board of Education (desegregation of schools).  Were there 1950s versions of David who marched into their children's schools, demanding that interracial marriage (GASP) not be exposed to their poor innocent children?  Were there similar lawsuits and appeals filed to try to get children "opted out" of social change?

I just have one more thing to get off my chest, and I know it's a desperate plea and that it won't change anybody's mind, but here it goes...

The United States is a secular government.  Which is to say, it's not religious in nature.  Therefore, when you say things like "God said so" in support of a legal document, YOU'RE DOING IT WRONG.  Religious laws should be used to govern your personal life, not to govern the people of this country.  I have absolutely no problem with the Catholics saying that they don't want to marry gay couples.  Fine.  But when you use your religion as reasoning behind a legal action, it is against the spirit of the constitution of these United States.

Tuesday, October 18, 2011

Dogs

The following conversation actually occurred during my class today.

Student 1:  A calculator is a man's best friend.
Student 2: I thought that a dog is a man's best friend.
Me: Ah, but since you can program a dog into your calculator, the calculator is really your best friend.

I then proceeded to enter aforementioned program into my calculator, which reads as follows (in calculator-language):
4->A
While(A>0)
Disp "Food?"
Pause
Disp "Play?"
Pause
End
For those who don't speak programming, this creates an infinite loop where the calculator dog asks you alternately for food and to play.  I thought it was pretty accurate.  I also am very happy that Kaylee is much more sophisticated than a dog:
She also sleeps where my feet go.  Bravo Kaylee.

 
 
 

Thursday, October 13, 2011

Math and Mathemagic

I had a fun lesson today in Statistics.  We just started talking about experimental design and actually how the statistics works (fuck off linear models, we're moving to important things now) and I really wanted to leave a good impression for when we start talking about confidence intervals and p-values.  So I came up with an activity to do.

The big question of the day that I wanted to answer was, "How do we know that an event is due to factors OTHER than random chance?"  The best example I could think of was a question I had on a statistics test.  "How many times would you have to a six on a six-sided die out of 120 rolls in order to be 95% confident that the die is loaded?"  Now, since I'm a good gamer, I don't have any loaded dice.  But I can force a card.
Pick a card, any card.... 
So I forced the card and then later in the lesson I revealed the card.  How can we be certain that I wasn't just plain lucky?  It spawned a fun discussion and realization that, no matter what the situation and what the sample, there's a small random chance that the unlikely happens.  And thus, we never "prove" or "disprove" anything with statistics.  We can only be 99% confident.

Statistics is fun.

Sunday, October 2, 2011

My mind is melting....

I was getting my Daily Show on.  Because it's the weekend and I have time.  Now, sometimes Hulu says, "would you like to watch the long-form commercial of something or another instead of the normal commercial breaks?"  Normally I say no when I'm watching a 30 minute show on the off chance that I get a 2.5 minute long commercial when normally I only get 1.5 minutes of commercials (I'm a mathematician; I can't help it).

Hulu very politely asks me, "Would you like to watch the Kohler advanced toilet long-form commercial?"

Like the questions "Do you want to smell this?  It smells awful," and "Can your farts save your buddy from drowning," (If you haven't watched at least one episode of MANswers, you should give it a shot just to see how dumb the male species is) this question only has one answer:  Fuck yes.

So I'm watching in awe as a camera pans around a bathroom which is nearly the ballsiest I've ever seen (the first being in my grandfather's house).  In the middle of the room sat the toilet, and on three sides were full room-height windows.  "Lid and seat open and close automatically," drifted across the screen.  "Fuck me," thought I, "this device can prevent 25% of all divorces in the United States!"  Next came, "heated seat" and "warms your feet."

But wait, there's more.  This toilet comes with a wireless touchscreen remote control.  If you haven't passed out from shock, perhaps you didn't hear me.  A WIRELESS TOUCHSCREEN REMOTE CONTROL.  FOR YOUR TOILET.

All this can be yours for the low low price of $4,000.