Saturday, September 20, 2008
More Poker Odds
Sunday, August 10, 2008
Some Numbers from the 2008 Olympics
Saturday, July 26, 2008
Hoops Analyst and R
data: Difference W = 0.9682, p-value = 0.5107
data: Offensive.Rank and Defensive.Rank t = 0.1257, df = 28, p-value = 0.9009
data: sum(Sign) and length(Sign) - 2
Sunday, July 20, 2008
The Basics of Poker
Say one was to go play a game of Texas Hold'em. What should the player know? Blackjack and craps have fairly simple strategies to follow to maximize expected play, or rather to minimize expected losses. For blackjack all someone has to do is remember a simple table. Poker is different. The basic requirement is to know the rules. What hands beat which hands, the order in which people bet, and generally how the game unfolds. Once the basics are learned, the two most important concepts are the Fundamental Theorem of Poker and bluffing. The fundamental theorem dictates that a player play his hand as if he could see everyone's cards and always applied the correct pot odds. Every time a player does this he increases his expected gain. Every time a player fails to do this, he is losing money.
Bluffing adds depth to poker. A player cannot follow the fundamental theorem perfectly. He can only guess what his opponents have. If a player plays his hand based on the fundamental theorem and never bluffs, his opponents will be able to accurately guess what cards he has and put him at a disadvantage. The skill in poker comes from balancing the concepts of the fundamental theorem and bluffing.
Those are the basics. Next it is important to get a sense for how often certain hands occur. Playing repeated hands of poker will give a player a good feel. A player gets two cards before he has to decide whether to play the hand or fold. What types of hands should a player ante up for and how often do those hands occur? Let us say a player likes to play the following types of hands: a pair, cards of the same suit that are adjacent (suited connectors), and two high cards (two cards that come from the set of 10, Jack, Queen, King, and Ace). Those are generally regarded as good hands to ante up on as they can lead to strong hands. Let the sets be defined as A for pairs, B for suited connectors, and C for high cards. The probability of getting one of those hands is the union of those three sets:
P(A U B U C) = P(A) + P(B) + P(C) -[P(AB) + P(AC) + P(BC)] + P(ABC)
Where 'U' indicates a union of sets and 'AB, ABC etc.' indicates an intersection of sets. For unions of sets, the basic rule is to add the sets of odd intersections and subtract the even intersections.
P(A) = probability of getting a pair. The first card can be anything. For a pair to occur the second card had to be one of the 3 remaining cards from the deck of 51. The first card in P(B) can be any card. For any card, there are two remaining cards that are suited connectors. If the first card was the Ace of Spades, the second card has to be the King or 2 of Spades. P(C) can only have a 10, Jack, Queen, King or Ace for its first card and second card. There are 20 such cards in the deck and 19 remaining after the first one has been dealt.
P(A) = (52/52)*(3/51)
P(B) = (52/52)*(2/51)
P(C) = (20/52)*(19/51)
The intersection P(ABC) and P(AB) cannot occur since two cards cannot be both a pair and suited connectors. P(AC) is the set of cards that are pairs of 10, Jack, Queen, King, or Ace. There are 13 different types of cards and P(AC) makes up 5 of those types (10, 10; Jack, Jack etc). P(AC) can be expressed as the portion of A that falls into C. Likewise with P(BC) with the caveat that only 4/13 types of suited connectors of B occur in C (since 10, 9 and Ace, 2 do not occur in C).
P(AC) = P(A)*(5/13)
P(BC) = P(B)*(4/13)
Plugging those into the formula:
P(A U B U C) = 20.6%
Thus a player that plays these types of hands will play roughly one of every five hands. To keep opponents from getting a clear read on what type of hands you prefer it may be advisable to play a junk hand occasionally.
I like playing suited connectors and pairs because if the next five cards improve your hand, a clear advantage can emerge. For example, if you play a suited connector and three of the next five cards are the same suit you get a flush. Unless there is a pair among those five cards, a flush will very likely be the best hand. But given that you played a pair or suited connector, what are the odds that the next five cards will improve your hand? I will attempt this question in the next post.
Sunday, July 6, 2008
The Gauntlet Revisited
If a team loses a challenge, two of its members have a duel in the Gauntlet. The losing player has to leave the show. After an unknown number of Gauntlets, the show has one final challenge in which the two teams compete for $300,000. The winning team divides the $300,000 equally between the remaining members. Going into the team challenges, the participants know whether it is a "guys'" or "girls'" day. On guys' days two men from the losing team duel in the Gauntlet. On girls' days two women compete. On guys' days the women face no punishment (i.e. the Gauntlet) for losing, and the men face no punishment for losing on girls' days. To entice the opposite sex to compet on their respective days, the show offers a prize to the winning team. On girls' days, men of the winning team each get a prize of roughly $500. However, if a team loses then one of its members will leave the show, meaning a larger portion of the $300,000 grand prize will go to those who remain.
First let's take a look at how much each remaining member stands to gain when a teammate loses in the Gauntlet. The left column is the number of people remaining on the team, the middle column is how much each member will receive if the team wins the final challenge, and the right column is how much more a player gets when a teammate leaves the show.
Teams start with 16 people and every time someone leaves, the remaining members can potentially win more prize money. The 'Difference' column shows that the more people leave, the more the rest stand to gain. When the first person leaves, everyone stands to win $1,250 more. When the 10th person leaves, the team members can win over $7,000 more. For example, in the final challenge the Veteran team stood to win roughly $30,000 each and the smaller Rookie team $60,000.
Let's take a look at the normal form representation of a single stage of this game. Let us assume that it is a girls' day and we are looking at the representation from the men's view. Assume that the men think they have a 50% possibility of winning the final challenge, thus they stand to gain $625 if they lose the challenge and a teammate (1250*.5 = 625). The men from both teams have the same strategy set: Try or Shirk. A team that chooses to Try will win 100% of the time against a Shirking team. Or perhaps more accurately, the Shirking team can make sure they lose with 100% certainty. If both teams Try they each have a 50% chance of winning, if both teams Shirk they each have a 50% chance of winning.
Thus Shirk dominates Try, since the chance of $1250 ($625) is greater than the $500 prize for winning the challenge. In the next stage game, the team that lost a member has a chance to win even more than $625, since the figures in the Difference column grow as more people leave the show. Using the binomial theorem one can calculate how much present value one gains by having the chance to lose more teammates. In the first stage matrix, the $625 jumps to over $3,000 in present value. The question is not why the Veteran men decided to Shirk challenges, but why didn't they start Shirking earlier?
The payoff matrix shows that the $500 prize is no deterrent. Are there other deterrents to Shirking? The final challenge determines the grand prize. If teams with more members had an advantage in that challenge, then that would be a deterrent to Shirking. However the format of the final challenge, common knowledge to the players because of previous versions of the show, does not favor large teams. It favors teams that do not have weak links and ones with strong athletes. Many Veteran men purposely Shirked because they thought it would improve their chances of winning the final challenge. The women realized that their probability of winning the final challenge would decrease if they lost strong athletes and were less likely to Shirk. A third deterrent might be an emotional reason. Perhaps pride, a competitive nature or a connection to members of the opposite sex motivated players not to Shirk. That might explain some of the romantic relationships.
The only tool the women have to deter Shirking is threat of reciprocal punishment. "If you Shirk and send one of us to the Gauntlet, we will Shirk and send one of you to the Gauntlet tomorrow." This strategy is undermined since losing too many athletic members hurts everyone on the team and because the remaining women also benefit from losing weaker members. By Shirking and losing strong men, the women hurt themselves. By losing the remaining women, they stand to make more money, and have a better chance of winning the final challenge. The Veteran men chose to Shirk, and the women had little recourse.
If both teams' men had realized the dominance of Shirk, there would have been some interesting repercussions. Both teams' men would be trying to lose on girls' days. To try to deter this, both teams' women might play the 'Mad President' strategy (act irrational-not a stretch for this group) and try to Shirk, the final challenge be damned. The Nash Equilibrium would probably involve an agreement between the men and women on each team with both sides agreeing that a certain amount of Shirking, to lose the weaker male and female competitors, is ideal and to only Shirk strategically in order to maximize the probability of winning the final challenge.
Sunday, June 29, 2008
Late Goals in Euro 2008
Which Half is the What Now?
x / (x+y+3.0*10^6) = 1/2
2x = x + y +3.0*10^6
x - 3.0*10^6 = y
This tells us that x > 3.0*10^6 and x > y, assuming that x + y > 0. The percentage of dead Americans who have died of heart attacks or strokes is equal to x/(x+y). Since x > y, x/(x+y) > 1/2. For example, suppose that 500 million Americans have died. Plugging that number into the formula:
x/(5.0*10^6+3.0*10^6) = 1/2
x = 4.0*10^6
x / (x+y) = % of dead Americans who have died of heart attacks or strokes
4.0*10^6 / 5.0*10^6 = .8 or 80% of dead Americans have died of heart attacks or strokes
I am unaware of what twisted game the doctor is playing. He is trying to emphasize the risk of heart attacks and strokes with the "1/2 comment", when he could quote the x / (x+y) = % of Americans who have died of heart attacks or strokes. The latter is larger than 1/2. A mystery of a man who is trying to shock the public and undersell the problem at the same time.
On a less mathematical note, there are worse things than heart attacks or strokes to have as the leading cause of death in a society. I am reading the book Chances Are... . I am surprised by how short the life expectancy for Londoners was in prior centuries and how resistant to statistical studies the medical community was. Unfortunately, as the NYTimes article details, there are still resistance to evidence based medicine.
Friday, June 20, 2008
When to Foul the Shooter
During the 2006-2007 NBA season, teams scored about 1.1 points per possession and made 75.5% of free throws. If the offensive team is in the bonus, a non-shooting foul results in the defense allowing .43 more expected points than they do on an average possession. 2*.752 - 1.1 = .43. It is better to let the possession elapse without commiting a non-shooting foul. The defensive team would rather not be in the bonus. Should you still foul the shooter on an easy shot?
Before estimating the additional penalty that committing a foul detracts, here are some statistics:
The difference in Total Points Lost is .343 which is < .4. Although the defense's Total Points Lost increases with the early foul it does not increase enough to justify letting a player have an easy shot. Thus the conventional wisdom is reaffirmed for the league average player; foul him rather than let him have an easy shot. If Total Points Lost had been more than .4, the next step would have been to calculate a more accurate Total Points Lost by accounting for offensive fouls (which do not result in free throws) and shooting fouls (which always result in free throws). However that is not needed and the reader will never learn that 9.8% of all fouls committed during the 2006-2007 NBA season were offensive fouls.
Sunday, June 15, 2008
Bringing Math to the Gauntlet
To determine which game the players will play in the Gauntlet, a wheel with six outcomes (five different games and a spin again) is spun. Since all five games have an equal chance of being selected, Player 1 can calculate his odds by estimating his subjective probability of winning in each individual game, summing the probabilities and dividing by five (the number of games). For example, if Player 1 believes that he is evenly match with his opponent in all five games, his chances of winning are 50%, shown by the formula Pv:
Pv (Probability of Victory) = (.5 + .5 + .5 +.5 + .5)/5 = .5 = 50%
The games are varied and certain games favor certain types of players. It is unlikely that a player would estimate himself as evenly matched with his opponent in all five games. Force Field-basically tug of war with pulleys-favors body strength and weight. Ankle Breakers-reverse tug of war with a rope tieing a player to his opponents ankle-and Ram it Home-a shoving match of sorts also favor strength and body weight. Sliders is a puzzle game that does not require athletic ability. Ball Brawl-a race to grab and carry a ball across a goal line-gives the advantage to the faster player. Let's do another example. This time Player 1 can select a weaker, smaller Player 2, who is faster and smarter (one would assume giving Player 2 an advantage in the puzzle game) than Player 1. Player 1 calculates the games in his favor of giving him a 70% chance of winning and only 30% for the games that favor Player 2.Pv = (.7 + .7 + .7 +.3 + .3)/5 = .54 = 54%
Another wrinkle. Ball Brawl is a repeated stage game. The winner is the first who scores 4 points. Repeated stage games, compared to a single elimination games, favor the team with a higher probability of winning. Much like the 7 game series of the NBA playoffs favor the better team more than the NCAA college basketball tournament does. If Player 1 believes that his chances of scoring in each stage game of Ball Brawl is 30%, his overall odds of winning the game drop to roughly 18%. The logic being it is easier for Player 1 to convert one 30% chance than it is to convert multiple 30% chances. The actual math can be calculated using the binomial theorem:
The winning player needs to score 4 points. There are five stage games in which to score points. In the first three stages, grabbing a ball and returning it over the goal line is worth 1 point. In the last two stages, a successful score is worth two points. The winning player needs to score 2 or 3 points in the first three stages and 2 points in the final two stages or to score 4 points in the final two stages. Say the probability of scoring in a stage game is .3. The function b(x) can be created to calculate the chance of winning ball brawl. b(.3) =
= .181 = 18% =
Or in Excel:
=BINOMDIST(2,2,.3,FALSE)+BINOMDIST(1,2,.3,FALSE)*(BINOMDIST(3,3,.3,FALSE)+BINOMDIST(2,3,.3,FALSE))
BINOMDIST(s, n, p, false) where s = number of successes, n = number of trials, p = probability of success for a trial, false = not cumulative
Formally, Pv = (p1 + p2 + p3 + p4 + b(p5)) / 5
where p1 = estimated probability of winning game 1, p2 = game 2, ..., p5 = prob of winning a stage in ball brawl
So what should Player 1 look for in an opponent? Since three games emphasize strength and body weight, Player 1's first criteria is to choose a weaker opponent. After that, the repeated stages of Ball Brawl, and the advantage it gives to the faster player, dictate choosing a slower opponent. The last criteria to evaluate is your potential opponent's intelligence. Big players will pick on small players and small players will choose weaker, slower, and or less intelligent small players.
More formally, the dominant strategy is to pick a person i ∈ S (set of of all players) for Player 2 such that Pv(i) ≥ Pv(j) for all players j ∈ S.
While I would be surprised if anybody on the Gauntlet reasoned his or her opponent selection out to this degree, it does explain why a player like Eric survived to the end of the competition. Eric was not suited for the final competition, but his sizable body weight and strength advantage made him an opponent no one wanted to face in the Gauntlet.