Showing posts with label strategy. Show all posts
Showing posts with label strategy. Show all posts

Monday, October 17, 2016

Presidential Election 2016: A Prisoner's Dilemma

Introduction

I wrote in a previous post that the 2016 Presidential election is a moral dilemma for many voters.  But that is not the only kind of dilemma we can use to analyze this event.  In this post, I look at the election as a sort of Prisoner's dilemma, that is, as a kind of economics, expected value, or rational dilemma.  We can take the analogy and assess the corresponding voter's dilemma in order to determine how this dilemma may be resolved.

The Prisoner's Dilemma

One can add nuances to the prisoner's dilemma, but the essential ingredients are something like the following. 
Two criminals that participated in the same crime are arrested and placed in separate cells from which they cannot communicate or coordinate.  The possible outcomes and resulting jail sentences are as follows:
    • If both prisoners betray each other by confessing the other's crime, both will serve 2 years in jail.
    • If one betrays the other, but the other remains silent, then the former will get out of jail while the latter will serve 3 years of jail time.
    • If neither betrays the other, then both of them will serve 1 year of jail time. 
What should the prisoners do?
The dilemma is that, from the standpoint of each individual prisoner, it is rational to betray the other prisoner.  If A betrays B, then either A gets out of jail immediately (B did not betray A) or A serves two years (B also betrayed A) which is better than 3 years (which would happen if B betrayed A but A didn't betray B).  So both prisoners reason that they should betray the other, and both end up with 2 years in jail.

However, from the "God's eye" perspective, the best solution is for neither prisoner to betray the other.  In the first scenario, 4 years total are served.  In the second scenario, 3 years are served.  In the last scenario, 2 years are served.  So if the prisoners are wanting to have the least amount of jail time in total, they should not betray each other.  This would be the rational thing to do.

So the dilemma is that if both prisoner's act rationally, this leads to a less desirable result for both.  But since it is irrational to act towards a less desirable result, rationality would seem to dictate a different course of action.  Since rationality seems to dictate two differing courses of action, we have a dilemma.  What in fact is the rational thing to do?  Is there a way to get to the overall optimal solution in which neither prisoner betrays the other?

The Solution: Communication/Coordination

Ultimately, the solution is to have communication/coordination.  If the prisoner's could coordinate their actions, then they could both not betray the other, and thus, end up in the most desirable outcome.  Such coordination is forbidden in the original setup, but in other setups, it is allowed.  It is this coordination and the feedback of what the other prisoner does which solves the dilemma.

The Voter's Dilemma

What does this have to do with the election?  Have you heard things like:
  • "Any third party vote is a vote for Trump."
  • "If you don't vote for Trump, then you are basically voting for Clinton."
  • "I'm not voting for Clinton: I'm voting against Trump."
I recall hearing that more than 60% of all voters are not voting for a candidate but are voting against the other candidate.  Most of us want a good third candidate, and maybe more of us could agree on a third candidate than we could on either Trump or Clinton.  If this were true, then this third candidate would actually be more popular than either Clinton or Trump.

However, we fear voting for a third party because if we do, our least favorite candidate may win.  So we ignore third parties, even if they could potentially unite more Americans than the other candidates could.  We compromise.  Again and again and again.  I vote Democrat and you vote Republican when maybe both of us would prefer a third option, or we could at least both agree to support a third option over the other two options as the best outcome overall.

If we could coordinate our voting, then maybe we could get out of the dilemma between the two major candidates and on to the optimal solution of a third party candidate.  But how can we do this?

A Solution?

It's rather strange that in 2016 we still have to wait for election day to coordinate our various desires for the President for the next 4 years by casting our vote.  And even then, the result may be surprising to many or most.  It is like we are all gambling.  How odd that elections of this magnitude should be a surprise in this day and age, and that we can't figure out a better way to coordinate our various interests towards the optimal solution.  Wouldn't it be nice if Democrats and Republicans could unite behind a single candidate who, through various means of communication, social media, polling, etc. was settled on prior to election day?  What if we could coordinate our votes to pick the best overall candidate?

This is not an endorsement for Gary Johnson, but I think the method proposed by this site to coordinate a Democrat's third party vote with a Republican's third party vote is getting at the sort of thing that is needed.  It provides a way out of the prisoner's dilemma for our 2016 election by coordinating the votes of would-be Democrats and Republicans towards a (presumably) more desirable third-party candidate.

Conclusion

Even if you are a hardline Democrat or Republican, I think you can agree that our current situation presents a real problem for our election system.  And I hope you can appreciate the similarities it has to the Prisoner's Dilemma.  Our method of voting does not seem to lead Americans towards the optimal candidate, a candidate that substantially more than 50.1% of Americans will support (and do so willingly, not begrudgingly).  Consequently, the more ways that we can find to effectively coordinate our electoral desires towards the best overall candidates, the better off we will all be, and the better off our elections will be.

Wednesday, February 17, 2016

Blackjack: A Paradox

Introduction

A friend of mine asked me to simulate blackjack deals to verify what he believed would be a new winning strategy in blackjack.  If you don't know the rules of blackjack, see here for the Wikipedia page.  The basic idea he had was that, assuming the dealer hits on 16 or below and stays on 17 or above, the face up cards that lead to a dealer bust should be different from what is typically assumed.

The typical assumption is that the next card is always a 10 in value, as 10s are the most common point value (16/52 are worth 10 points).  Assuming this and the dealer rules, we would expect the dealer to bust the most on face up 2s through 6s.  Why?  Because if a dealer gets a 6 face up, we believe him to have a 10 face down, which adds to 16, which means he has to hit.  But getting another 10 gives him 26 which is a bust.  Similarly down to 2 (2->12->22 = bust).

However, while it is true that 10 is the most common point value for a card, the average point value in the deck is about 7 (higher or lower depending on if the Ace is an 11 or 1 in any hand).  So we should expect any hidden cards to average about 7 points.  But if this is true, then the dealer should bust with a different set of face up cards.  For instance, if we assume the average to be 7, then we would expect 2, 8, and 9 to be the bust cards (2->9->16->23; 8->15->22; 9->16->23).  If you choose a different average calculation, you can get a different set of face up bust cards.

So which is it?  As it turns out, the original basic strategy of assuming the next card is a 10 is the correct approach.  But why?  This leads to the following paradox as both approaches seem intuitively correct:

The paradox: If the average value of a card in blackjack is about 7, why is the basic winning strategy to assume that the next card is a 10?

Data Exploration

The dealer busts about 28.6% of the time and stays about 71.4% of the time.  The dealer does in fact bust most frequently on face up 2s-6s.  See the table below (J=11, Q=12, K=13, A=14). This is based on 100,000 simulations.  5s and 6s are highest at about 43% of the time:

Face Up
Busted
Stay
Busted/Total
2
2671
4964
0.350
3
2828
4742
0.374
4
3136
4522
0.410
5
3338
4320
0.436
6
3294
4445
0.426
7
2047
5720
0.264
8
1817
5945
0.234
9
1771
5880
0.231
10
1670
6005
0.218
11
1623
6106
0.210
12
1679
5950
0.220
13
1716
6002
0.222
14
1012
6797
0.130

So the original basic strategy is correct that the bust cards are 2-6.  And there is a significant break between 6 and 7.  But why is this the case?  Let's do some exploring.

 Averages:

The average value of the cards in a dealer's hand when he busts is 7.03.  When he stays, its  7.61.  Breaking this down by face up card, we have the below table:

Face Up
Busted
Stay
Difference
2
6.076
5.548
0.529
3
6.383
5.696
0.688
4
6.726
5.814
0.911
5
7.052
5.877
1.175
6
7.500
6.350
1.150
7
7.162
7.380
-0.217
8
7.283
7.878
-0.596
9
7.467
8.359
-0.892
10
7.579
8.869
-1.290
11
7.597
8.878
-1.281
12
7.570
8.869
-1.299
13
7.586
8.888
-1.302
14
5.419
8.504
-3.085


Interestingly, the bust averages for 2-6 are higher than the stay averages, but the opposite is true for 7-14.  Why is this the case?  Perhaps another table of the average count of cards will help:

Face Up
Busted
Stay
Difference
2
3.946
3.517
0.429
3
3.783
3.422
0.361
4
3.606
3.338
0.269
5
3.478
3.284
0.194
6
3.296
3.047
0.249
7
3.399
2.580
0.819
8
3.317
2.467
0.850
9
3.233
2.366
0.867
10
3.174
2.257
0.917
11
3.169
2.255
0.915
12
3.184
2.256
0.928
13
3.172
2.255
0.917
14
4.454
2.520
1.934


Busts on average require more cards than stays, which makes sense, because a bust goes over 21 while a stay is between 17-21.  On average, it takes more cards to get a higher value, hence, getting over 21 takes more cards than getting between 17 and 21.

However, there is a big break in average counts of cards between face up 2s-6s and face up 7s-14s that matches the break in average values of cards.  Why should this exist?

If we start with the assumption that the next card (or any hidden card) is a 10, then this is to be expected.  With that assumption, a face up 6 or below is a total of 16 or below (hit) while a 7 face up is a total of 17 (stay).  A hit requires one more card at least, so it makes sense that a large break occurs between 6 and 7. 

Also,  the higher the face up card, the more likely a stay is with only 2 cards, meaning that each card is on average larger than a similar stay with 3 cards.  For example, a stay of 17 with a 10 and 7 averages 8.5 per card while a stay of 17 with an 8, 2, and 7 averages 5.7 per card.  As the face up card gets smaller, the amount of cards needed to get to a stay or bust increases, since the cards are worth less, hence, the averages get smaller.

But this isn't the whole story.  The first table really comes from the combination of the second table and another table, the average hand value for the dealer by face up card.  We can see that the busted averages are largely the same with the highest value at 6.  The stay averages are also similar with a notable low value at 7.  The difference between the busted total value and the stay total value shows a peak of 5.6 at a face up value of 7, and this decreases to either side.

This makes sense, since a 7 face up (and a hidden 10) is the lowest possible stay, while a 6 face up (with a hidden 10) is the highest hit.  So we should expect the greatest difference between busts and stays to be right around the 6 and 7 divide.

Face Up
Busted
Stay
Difference
2
23.325
18.917
4.408
3
23.403
18.974
4.429
4
23.570
18.967
4.603
5
23.843
18.920
4.923
6
24.159
18.761
5.398
7
23.740
18.100
5.640
8
23.692
18.466
5.226
9
23.732
18.865
4.867
10
23.765
19.263
4.502
11
23.792
19.276
4.516
12
23.783
19.261
4.522
13
23.784
19.276
4.507
14
23.712
19.528
4.185


So a large difference in the middle combined with decreasing average counts of cards in the dealers hand makes for a switch in the difference of average card values at the 6/7 divide.  And all of this makes sense when we expect the next (or hidden) card to have a value of 10.

Counts of 10s:

Is assuming that the next (or hidden) card is a 10 in value a good assumption? In a way, yes.  71% of dealer hands have a 10 in them.  Thus, it is reasonable to assume that the dealer will have a 10 face down or at least coming as a third card.  That is, most of the time, the dealer will have a 10 in the hand.

Here is a more detailed breakdown:

Count of 10s
Busted
Stay
0
4154
24520
1
15002
37876
2
9446
9002

The dealer busts only 4% of the time without any 10s.  That is, only 15% of busts lack a 10 valued card.  That means that 85% of busts have at least one 10 involved.  With stays, only 34% of them lack a 10. 

If we remove the possibility of getting a 10 valued card as the face up, then 59% of hands will still have a 10 valued card hidden or coming.  In greater detail:


Count of 10s
Busted
Stay
0
4154
24520
1
12587
22815
2
5173
0

81% of these busts have a 10 involved.  Stays are split nearly 50-50 on having a 10 or not.  When a 10 is involved, 43% of the time the dealer busts.

Clearly, one should expect the dealer to get a 10 valued card.

Combining Averages with 10s

Suppose the dealer gets one 10 valued card (not the face up), which happens 51% of the time.  What happens then?
  • Let's assume the other card besides the face up card is a 7 (the average).  If the 10 comes first, then a bust comes on face up 5 and 6, which are the most likely to bust.  If the 10 comes second, then 5-9 are busts.
  • If the other card is an 8 (the median), a bust happens on 4-6 with the 10 coming first, and 4-8 when it comes second.
  • If the other card is a 10 (the mode) (7% of the time), then a bust happens on 2-6.
So we see that busting on 5-6 is very likely in all circumstances, and then depending on what we take to be the best representative of the set (mean vs. median vs. mode), additional face up values lead to busting.

When we combine all of these together, it is not surprising that we do get the following result of bust averages by face up value, now ordered from most likely to least:

Face Up
Busted
Stay
Busted/Total
5
3338
4320
0.436
6
3294
4445
0.426
4
3136
4522
0.410
3
2828
4742
0.374
2
2671
4964
0.350
7
2047
5720
0.264
8
1817
5945
0.234
9
1771
5880
0.231
13
1716
6002
0.222
12
1679
5950
0.220
10
1670
6005
0.218
11
1623
6106
0.210
14
1012
6797
0.130

Still, if we had to pick one number to represent the set of values, it seems that 10 (the mode) is the best number to do so, and not the mean or the median.  This best aligns with the face up value busts.  But why?

Resolving the Paradox: A Statistical Lesson

If assuming that a hidden card is a 10 in value is the right approach, why is assuming that the next card is a 7 in value a bad approach?  In other words, why does the mode take priority over the mean in representing the distribution of values of cards in blackjack?

The answer lies in the distribution of values in blackjack.  A hidden assumption in my friend's approach is that the average value of the cards was from an approximately normal distribution.  If that were the case, then we could expect the next card to be, on average, a 7, because in fact, the average card would be about a 7.

However, blackjack values are not normally distributed.  There are 4 times as many 10s as there are of any other card value.  As a result, using the average value of the cards to represent any hidden card values is misleading.  This is a misuse of the mean to represent the sample.



To make this point more obvious, suppose we played a game in which every card was worth 200 points except for the 2 of clubs and 2 of spades, which were both worth -5000 points.  The average value of the cards in this set is 0 points.  However, most of the time, the next card played will be worth 200 points. And no card is in fact worth 0 points.




In this circumstance, it makes sense to treat every next card as being worth 200 points, knowing full well that 2 of the cards will be worth much less.  Why?  Because in fact, most of the time, the next card will be 200 points.  The best strategy for winning the game will likely assume that every hidden card is worth 200 points.

Conclusion

Going back to blackjack, and given the foregoing, the best simple assumption does seem to be that any hidden card is a 10 in value.  If we make this a bit more complex, the assumption becomes that the dealer will get at least one 10 valued card.  So if this is not the face up card, we should expect it to be the face down card or a hit card.  This, combined with what we have discovered about the mean and median, leads us view face up cards 2-6 as bust cards, with 5s and 6s being especially important.

The statistical lesson to be learned is that one must be careful in using the mean (or median or mode) to represent the dataset.  Do a sanity check.  Look at the data.  Does it make sense, or does it mischaracterize the data?  Using the word "expected" helps.  Does the mean represent what I expect any unknown value to be, or is the mode or something else a better representation of what is expected? 

Context is also important.  Saying that the average value of a data set is X really does not tell us much about that dataset.  Putting that into the context of the distribution, standard deviation, skew, mode, median, and other various statistical measures and descriptions can help us understand what the data is really like, and how we can best use that data to make good decisions.

It has been said that there are three kinds of lies: "lies, damned lies, and statistics."  Make sure your statistics do not misrepresent the true nature of the data and become worse than damned lies.