Table Of Content
Probability,DecisionsandGames
Probability, Decisions and Games
AGentleIntroductionusingR
AbelRodríguez
BrunoMendes
Thiseditionfirstpublished2018
©2018JohnWiley&Sons,Inc.
Allrightsreserved.Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,or
transmitted,inanyformorbyanymeans,electronic,mechanical,photocopying,recordingor
otherwise,exceptaspermittedbylaw.Adviceonhowtoobtainpermissiontoreusematerialfrom
thistitleisavailableathttp://www.wiley.com/go/permissions.
TherightofAbelRodríguezandBrunoMendestobeidentifiedastheauthorsofthisworkhas
beenassertedinaccordancewithlaw.
RegisteredOffices
JohnWiley&Sons,Inc.,111RiverStreet,Hoboken,NJ07030,USA
EditorialOffice
111RiverStreet,Hoboken,NJ07030,USA
Fordetailsofourglobaleditorialoffices,customerservices,andmoreinformationaboutWiley
productsvisitusatwww.wiley.com.
Wileyalsopublishesitsbooksinavarietyofelectronicformatsandbyprint-on-demand.Some
contentthatappearsinstandardprintversionsofthisbookmaynotbeavailableinotherformats.
LimitofLiability/DisclaimerofWarranty
Thepublisherandtheauthorsmakenorepresentationsorwarrantieswithrespecttotheaccuracy
orcompletenessofthecontentsofthisworkandspecificallydisclaimallwarranties;including
withoutlimitationanyimpliedwarrantiesoffitnessforaparticularpurpose.Thisworkissold
withtheunderstandingthatthepublisherisnotengagedinrenderingprofessionalservices.The
adviceandstrategiescontainedhereinmaynotbesuitableforeverysituation.Inviewofon-going
research,equipmentmodifications,changesingovernmentalregulations,andtheconstantflow
ofinformationrelatingtotheuseofexperimentalreagents,equipment,anddevices,thereaderis
urgedtoreviewandevaluatetheinformationprovidedinthepackageinsertorinstructionsfor
eachchemical,pieceofequipment,reagent,ordevicefor,amongotherthings,anychangesinthe
instructionsorindicationofusageandforaddedwarningsandprecautions.Thefactthatan
organizationorwebsiteisreferredtointhisworkasacitationand/orpotentialsourceoffurther
informationdoesnotmeanthattheauthororthepublisherendorsestheinformationthe
organizationorwebsitemayprovideorrecommendationsitmaymake.Further,readersshould
beawarethatwebsiteslistedinthisworkmayhavechangedordisappearedbetweenwhenthis
workswaswrittenandwhenitisread.Nowarrantymaybecreatedorextendedbyany
promotionalstatementsforthiswork.Neitherthepublishernortheauthorshallbeliableforany
damagesarisingherefrom.
LibraryofCongressCataloging-in-PublicationData:
Names:Rodríguez,Abel,1975-author.|Mendes,Bruno,1970-author.
Title:Probability,decisions,andgames:agentleintroductionusingR/by
AbelRodríguez,BrunoMendes.
Description:Hoboken,NJ:Wiley,2018.|Includesindex.|
Identifiers:LCCN2017047636(print)|LCCN2017059013(ebook)|ISBN
9781119302612(pdf)|ISBN9781119302629(epub)|ISBN9781119302605(pbk.)
Subjects:LCSH:Gametheory–Textbooks.|Gametheory–Dataprocessing.|
Statisticaldecision–Textbooks.|Statisticaldecision–Dataprocessing.
|Probabilities–Textbooks.|Probabilities–Dataprocessing.|R
(Computerprogramlanguage)
Classification:LCCQA269(ebook)|LCCQA269.R632018(print)|DDC
519.30285/5133–dc23
LCrecordavailableathttps://lccn.loc.gov/2017047636
Coverdesign:Wiley
Coverimage:©Jupiterimages/GettyImages
Setin10/12ptWarnockProbySPiGlobal,Chennai,India
PrintedintheUnitedStatesofAmerica
10 9 8 7 6 5 4 3 2 1
ToSabrina
Abel
Tomyfamily
Bruno
vii
Contents
Preface xi
Acknowledgments xv
AbouttheCompanionWebsite xvii
1 AnIntroductiontoProbability 1
1.1 WhatisProbability? 1
1.2 OddsandProbabilities 5
1.3 EquiprobableOutcomeSpacesandDeMéré’sProblem 6
1.4 ProbabilitiesforCompoundEvents 9
1.5 Exercises 12
2 ExpectationsandFairValues 15
2.1 RandomVariables 15
2.2 ExpectedValues 16
2.3 FairValueofaBet 19
2.4 ComparingWagers 19
2.5 UtilityFunctionsandRationalChoiceTheory 23
2.6 LimitationsofRationalChoiceTheory 24
2.7 Exercises 26
3 Roulette 31
3.1 RulesandBets 31
3.2 CombiningBets 37
3.3 BiasedWheels 38
3.4 Exercises 42
4 LottoandCombinatorialNumbers 45
4.1 RulesandBets 45
4.1.1 TheColoradoLotto 45
4.1.2 TheCaliforniaSuperlotto 51
viii Contents
4.2 SharingProfits:DeMéré’sSecondProblem 52
4.3 Exercises 55
5 TheMontyHallParadoxandConditionalProbabilities 59
5.1 TheMontyHallParadox 59
5.2 ConditionalProbabilities 62
5.3 IndependentEvents 65
5.4 BayesTheorem 66
5.5 Exercises 70
6 Craps 75
6.1 RulesandBets 75
6.1.1 ThePassLineBet 75
6.1.2 TheDon’tPassLineBet 84
6.1.3 TheComeandDon’tComeBets 85
6.1.4 SideBets 85
6.2 Exercises 86
7 RouletteRevisited 89
7.1 GamblingSystems 89
7.1.1 MartingaleDoublingSystems 89
7.1.2 TheLabouchèreSystem 92
7.1.3 D’AlembertSystems 94
7.2 YouareaBigWinner! 96
7.3 HowLongwillMyMoneyLast? 97
7.4 IsThisWheelBiased? 101
7.5 BernoulliTrials 102
7.6 Exercises 103
8 Blackjack 107
8.1 RulesandBets 107
8.2 BasicStrategyinBlackjack 109
8.3 AGamblingSystemthatWorks:CardCounting 114
8.4 Exercises 117
9 Poker 121
9.1 BasicRules 121
9.2 VariantsofPoker 123
9.3 AdditionalRules 124
9.4 ProbabilitiesofHandsinDrawPoker 124
9.4.1 TheEffectofCardSubstitutions 127
9.5 ProbabilitiesofHandsinTexasHold’em 128
9.6 Exercises 132
Contents ix
10 StrategicZero-SumGameswithPerfectInformation 135
10.1 GameswithDominantStrategies 135
10.2 SolvingGameswithDominantandDominatedStrategies 139
10.3 GeneralSolutionsforTwoPersonZero-SumGames 143
10.4 Exercises 144
11 Rock–Paper–Scissors:MixedStrategiesinZero-Sum
Games 147
11.1 FindingMixed-StrategyEquilibria 148
11.2 MixedStrategyEquilibriainSports 152
11.3 BluffingasaStrategicGamewithaMixed-Strategy
Equilibrium 153
11.4 Exercises 159
12 ThePrisoner’sDilemmaandOtherStrategicNon-zero-sum
Games 161
12.1 ThePrisoner’sDilemma 161
12.2 TheImpactofCommunicationandAgreements 162
12.3 WhichEquilibrium? 164
12.4 AsymmetricGames 168
12.5 Exercises 171
13 Tic-Tac-ToeandOtherSequentialGamesofPerfect
Information 175
13.1 TheCentipedeGame 175
13.2 Tic-Tac-Toe 178
13.3 TheGameofNimandtheFirst-andSecond-Mover
Advantages 181
13.4 CanSequentialGamesbeFun? 184
13.5 TheDiplomacyGame 184
13.6 Exercises 187
A ABriefIntroductiontoR 191
A.1 InstallingR 191
A.2 SimpleArithmetic 192
A.3 Variables 194
A.4 Vectors 195
A.5 Matrices 199
A.6 LogicalObjectsandOperations 201
A.7 CharacterObjects 204
A.8 Plots 205
x Contents
A.9 Iterators 208
A.10 SelectionandForking 211
A.11 OtherThingstoKeepinMind 211
Index 213
xi
Preface
WhyGamblingandGaming?
Gamesareauniversalpartofhumanexperienceandarepresentinalmostevery
culture;theearliestgamesknown(suchassenetinEgyptortheRoyalGameof
Ur in Iraq) date back to at least 2600 B.C. Games are characterized by a set
ofrulesregulatingthebehaviorofplayersandbyasetofchallengesfacedby
thoseplayers,whichmightinvolveamonetaryornonmonetarywager.Indeed,
thehistoryofgamingisinextricablylinkedtothehistoryofgambling,andboth
haveplayedanimportantroleinthedevelopmentofmodernsociety.
Gameshavealsoplayedaveryimportantroleinthedevelopmentofmodern
mathematical methods, and they provide a natural framework to introduce
simple concepts that have wide applicability in real-life problems. From the
pointofviewofthemathematicaltoolsusedfortheiranalysis,gamescanbe
broadlydividedbetweenrandomgamesandstrategicgames.Randomgames
pit one or more players against “nature” that is, an unintelligent opponent
whose acts cannot be predicted with certainty. Roulette is the quintessential
exampleofarandomgame.Ontheotherhand,strategicgamespittwoormore
intelligentplayersagainsteachother;thechallengeisforoneplayertooutwit
their opponents. Strategic games are often subdivided into simultaneous
(e.g., rock–paper–scissors) and sequential (e.g., chess, tic-tac-toe) games,
dependingontheorderinwhichtheplayerstaketheiractions.However,these
categoriesarenotmutuallyexclusive;mostmoderngamesinvolveaspectsof
bothstrategicandrandomgames.Forexample,pokerincorporateselements
of random games (cards are dealt at random) with those of a sequential
strategicgame(bettingismadeinroundsand“bluffing”canwinyouagame
evenifyourcardsareworsethanthoseofyouropponent).
Oneofthekeyideasbehindthemathematicalanalysisofgamesistheratio-
nality assumption, that is, that players are indeed interested in winning the
gameandthattheywilltake“optimal”(i.e.,rational)stepstoachievethis.Under
theseassumptions,wecanpostulateatheoryofhowdecisionsaremade,which
reliesonthemaximizationofautilityfunction(often,butcertainlynotalways,