1. Trang chủ
  2. » Công Nghệ Thông Tin

Probability, decisions and games a gentle introduction using r

223 59 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 223
Dung lượng 9,47 MB

Nội dung

Table of Contents Cover Title Page Copyright Dedication Preface Why Gambling and Gaming? Using this Book Acknowledgments About the Companion Website Chapter 1: An Introduction to Probability 1.1 What is Probability? 1.2 Odds and Probabilities 1.3 Equiprobable Outcome Spaces and De Méré's Problem 1.4 Probabilities for Compound Events 1.5 Exercises Chapter 2: Expectations and Fair Values 2.1 Random Variables 2.2 Expected Values 2.3 Fair Value of a Bet 2.4 Comparing Wagers 2.5 Utility Functions and Rational Choice Theory 2.6 Limitations of Rational Choice Theory 2.7 Exercises Chapter 3: Roulette 3.1 Rules and Bets 3.2 Combining Bets 3.3 Biased Wheels 3.4 Exercises Chapter 4: Lotto and Combinatorial Numbers 4.1 Rules and Bets 4.2 Sharing Profits: De Méré's Second Problem 4.3 Exercises Chapter 5: The Monty Hall Paradox and Conditional Probabilities 5.1 The Monty Hall Paradox 5.1 The Monty Hall Paradox 5.2 Conditional Probabilities 5.3 Independent Events 5.4 Bayes Theorem 5.5 Exercises Chapter 6: Craps 6.1 Rules and Bets 6.2 Exercises Chapter 7: Roulette Revisited 7.1 Gambling Systems 7.2 You are a Big Winner! 7.3 How Long will My Money Last? 7.4 Is This Wheel Biased? 7.5 Bernoulli Trials 7.6 Exercises Chapter 8: Blackjack 8.1 Rules and Bets 8.2 Basic Strategy in Blackjack 8.3 A Gambling System that Works: Card Counting 8.4 Exercises Chapter 9: Poker 9.1 Basic Rules 9.2 Variants of Poker 9.3 Additional Rules 9.4 Probabilities of Hands in Draw Poker 9.5 Probabilities of Hands in Texas Hold'em 9.6 Exercises Chapter 10: Strategic Zero-Sum Games with Perfect Information 10.1 Games with Dominant Strategies 10.2 Solving Games with Dominant and Dominated Strategies 10.3 General Solutions for Two Person Zero-Sum Games 10.4 Exercises Chapter 11: Rock–Paper–Scissors: Mixed Strategies in Zero-Sum Games 11.1 Finding Mixed-Strategy Equilibria 11.2 Mixed Strategy Equilibria in Sports 11.3 Bluffing as a Strategic Game with a Mixed-Strategy Equilibrium 11.4 Exercises Chapter 12: The Prisoner's Dilemma and Other Strategic Non-zero-sum Games 12.1 The Prisoner's Dilemma 12.2 The Impact of Communication and Agreements 12.3 Which Equilibrium? 12.4 Asymmetric Games 12.5 Exercises Chapter 13: Tic-Tac-Toe and Other Sequential Games of Perfect Information 13.1 The Centipede Game 13.2 Tic-Tac-Toe 13.3 The Game of Nim and the First- and Second-Mover Advantages 13.4 Can Sequential Games be Fun? 13.5 The Diplomacy Game 13.6 Exercises Appendix A: A Brief Introduction to R A.1 Installing R A.2 Simple Arithmetic A.3 Variables A.4 Vectors A.5 Matrices A.6 Logical Objects and Operations A.7 Character Objects A.8 Plots A.9 Iterators A.10 Selection and Forking A.11 Other Things to Keep in Mind Index End User License Agreement List of Illustrations Chapter 1: An Introduction to Probability Figure 1.1 Cumulative empirical frequency of heads (black line) in 5000 simulated flips of a fair coin The gray horizontal line corresponds to the true probability Figure 1.2 Venn diagram for the (a) union and (b) intersection of two events Figure 1.3 Venn diagram for the addition rule Chapter 2: Expectations and Fair Values Figure 2.1 Running profits from a wager that costs $1 to join and pays nothing if a coin comes up tails and $1.50 if the coin comes up tails (solid line) The gray horizontal line corresponds to the expected profit Figure 2.2 Running profits from Wagers (continuous line) and (dashed line) Figure 2.3 Running profits from Wagers (continuous line) and (dashed line) Chapter 3: Roulette Figure 3.1 The wheel in the French/European (left) and American (right) roulette and respective areas of the roulette table where bets are placed Figure 3.2 Running profits from a color (solid line) and straight-up (dashed line) bet Figure 3.3 Empirical frequency of each pocket in 5000 spins of a biased wheel Figure 3.4 Cumulative empirical frequency for a single pocket in an unbiased wheel Chapter 5: The Monty Hall Paradox and Conditional Probabilities Figure 5.1 Each branch in this tree represents a different decision and the represent the probability of each door being selected to contain the prize s Figure 5.2 The tree structure now represents an extra level, representing the contestant decisions and the probability for each decision to be the one chosen Figure 5.3 Decision tree for the point when Monty decides which door to open assuming the prize is behind door Figure 5.4 Partitioning the event space Figure 5.5 Tree representation of the outcomes of the game of urns under the optimal strategy that calls yellow balls as coming from Urn and blue and red balls as coming from urn Chapter 6: Craps Figure 6.1 The layout of a craps table Figure 6.2 Tree representation for the possible results of the game of craps Outcomes that lead to the pass line bet winning are marked with W, while those that lead to a lose are marked L Figure 6.3 Tree representation for the possible results of the game of craps with the probabilities for each of the come-out roll Figure 6.4 Tree representation for the possible results of the game of craps with the probabilities for all scenarios Chapter 7: Roulette Revisited Figure 7.1 The solid line represents the running profits from a martingale doubling system with $1 initial wagers for an even bet in roulette The dashed horizontal line indicates the zero-profit level Figure 7.2 Running profits from a Labouchère system with an initial list of $50 entries of $10 for an even bet in roulette Note that the simulation stops when the cumulative profit is ; the number of spins necessary to reach this number will vary from simulation to simulation Figure 7.3 Running profits over 10,000 spins from a D'Alembert system with an initial bet of $5, change in bets of $1, minimum bet of $1 and maximum bet of $20 to an even roulette bet Chapter 8: Blackjack Figure 8.1 A 52-card French-style deck Chapter 9: Poker Figure 9.1 Examples of poker hands Chapter 11: Rock–Paper–Scissors: Mixed Strategies in Zero-Sum Games Figure 11.1 Graphical representation of decisions in a simplified version of poker Chapter 12: The Prisoner's Dilemma and Other Strategic Non-zero-sum Games Figure 12.1 Expected utilities for Ileena (solid line) and Hans (dashed line) in the game of chicken as function of the probability that Hans will swerve with probability if we assume that Ileena swerves with probability Figure 12.2 Expected utilities for Ileena (solid line) and Hans (dashed line) in the game of chicken as function of the probability that Ileena will swerve with probability if we assume that Hans swerves with probability Figure 12.3 Expected utilities for Ileena (solid line) and Hans (dashed line) in the game of chicken as function of the probability that Hans will swerve with probability if we assume that Ileena always swerves Chapter 13: Tic-Tac-Toe and Other Sequential Games of Perfect Information Figure 13.1 Extensive-form representation of the centipede game Figure 13.2 Reduced extensive-form representation of the centipede game after solving for Carissa's optimal decision during the third round of play Figure 13.3 Reduced extensive-form representation of the centipede game after solving for Sahar's optimal decision during the second round of play and Carissa's optimal decision during the third round of play Figure 13.4 A game of tic-tac-toe where the player represented by X plays first and the player represented by O wins the game The boards should be read left to right and then top to bottom Figure 13.5 A small subsection of the extensive-form representation of tic-tac-toe Figure 13.6 Examples of boards in which the player using the X mark created a fork for themselves, a situation that should be avoided by their opponent In the left figure, player (who is using the X) claimed the top left corner in their first move, then player claimed the top right corner, player responded by claiming the bottom right corner, which forces player to claim the center square (in order to block a win), and player claims the bottom left corner too At this point, player has created a fork since they can win by placing a mark on either of the cells marked with an F Similarly, in the right Figure player claimed the top left corner, player responded by claiming the bottom edge square, then player took the center square, which forced player to take the bottom right corner to block a win After that, if player places their mark on the bottom left corner they would have created a fork Figure 13.7 Extended-form representation of the game of Nim with four initial pieces Figure 13.8 Pruned tree for a game of Nim with four initial pieces after the optimal strategy at the third round has been elucidated Figure 13.9 Pruned tree for a game of Nim with four initial pieces after the optimal strategy at the second round has been elucidated Figure 13.10 The diplomacy game in extensive form Figure 13.11 First branches pruned in the diplomacy game Figure 13.12 Pruned tree associated with the diplomacy game Appendix A: A Brief Introduction to R Figure A.1 The R interactive command console in a Mac OS X computer The symbol > is a prompt for users to provide instructions; these will be executed immediately after the user presses the RETURN key Figure A.2 A representation of a vector x of length as a series of containers, each one of them corresponding to a different number Figure A.3 An example of a scatterplot in R]An example of a scatterplot in R Figure A.4 An example of a line plot in R Figure A.5 Adding multiple plots and reference lines to a single graph Figure A.6 Example of a barplot in R List of Tables Chapter 1: An Introduction to Probability Table 1.1 Two different ways to think about the outcome space associated with rolling two dice Chapter 2: Expectations and Fair Values Table 2.1 Winnings for the different lotteries in Allais paradox Table 2.2 Winnings for 11% of the time for the different lotteries in Allais paradox Chapter 3: Roulette Table 3.1 Inside bets for the American wheel Table 3.2 Outside bets for the American wheel Table 3.3 Outcomes of a combined bet of $2 on red and $1 on the second dozen Chapter 4: Lotto and Combinatorial Numbers Table 4.1 List of possible groups of out of numbers, if the order of the numbers is not important Chapter 5: The Monty Hall Paradox and Conditional Probabilities Table 5.1 Probabilities of winning if the contestant in the Monty problem switches doors Table 5.2 Studying the relationship between smoking and lung cancer Chapter 6: Craps Table 6.1 Names associated with different combinations of dice in craps Table 6.2 All possible equiprobable outcomes associated with two dice being rolled Table 6.3 Sum of points associated with the roll of two dice Chapter 7: Roulette Revisited Table 7.1 Accumulated losses from playing a martingale doubling system with an initial bet of $1 and an initial bankroll of $1000 Table 7.2 Probability that you play exactly dollar for between and rounds before you lose your first Chapter 8: Blackjack Table 8.1 Probability of different hands assuming that the house stays on all 17s and that the game is being played with a large number of decks Table 8.2 Probability of different hands assuming that the house stays on all 17s, conditional on the face-up card Table 8.3 Optimal splitting strategy Table 8.4 Probability of different hands assuming that the house stays on all 17s and that the game is being played with a single deck where all Aces, 2s, 3s, 4s, 5s, and 6s have been removed Table 8.5 Probability of different hands assuming that the house stays on all 17s, conditional on the face-up card Chapter 9: Poker Table 9.1 List of poker hands Table 9.2 List of opponent's poker hands that can beat our two-pair Chapter 10: Strategic Zero-Sum Games with Perfect Information Table 10.1 Profits in the game between Pevier and Errian Table 10.2 Poll results for Matt versus Ling (first scenario) Table 10.3 Best responses for Matt (first scenario) Table 10.4 Best responses for Ling (first scenario) Table 10.5 Poll results for Matt versus Ling (second scenario) Table 10.6 Best responses for Matt (second scenario) Table 10.7 Best responses for Ling (second scenario) Table 10.8 Poll results for Matt versus Ling (third scenario) Table 10.9 Best responses for Ling (third scenario) Table 10.10 Best responses for Matt (third scenario) Table 10.11 Reduced Table for poll results for Matt versus Ling Table 10.12 A game without dominant or dominated strategies Table 10.13 Best responses for Player in our game without dominant or dominated strategies Table 10.14 Best responses for Player in our game without dominant or dominated strategies Table 10.15 Example of a game with multiple equilibria Chapter 11: Rock–Paper–Scissors: Mixed Strategies in Zero-Sum Games Table 11.1 Player's profit in rock–paper–scissors Table 11.2 Best responses for Jiahao in the game of rock–paper–scissors Table 11.3 Utility associated with different actions that Jiahao can take if he assumes that Antonio selects rock with probability , paper with probability and scissors with probability Table 11.4 Utilities associated with different penalty kick decisions Table 11.5 Utility associated with different actions taken by the kicker if he assumes that goal keeper selects left with probability , center with probability , and right with probability Table 11.6 Expected profits in the simplified poker Table 11.7 Best responses for you in the simplified poker game Table 11.8 Best responses for Alya in the simplified poker game Table 11.9 Expected profits in the simplified poker game after eliminating dominated strategies Table 11.10 Expected profits associated with different actions you take if you assume that Alya will select with probability and with probability Chapter 12: The Prisoner's Dilemma and Other Strategic Non-zero-sum Games Table 12.1 Payoffs for the prisoner's dilemma Table 12.2 Best responses for Prisoner in the prisoner's dilemma game Table 12.3 Communication game in normal form Table 12.4 Best responses for Anastasiya in the communication game Table 12.5 Best responses for Anil in the communication game Table 12.6 Expected utility for Anil in the communication game Table 12.7 The game of chicken Table 12.8 Best responses for Ileena in the game of chicken Table 12.9 Expected utility for Ileena in the game of chicken Table 12.10 A fictional game of swords in Star Wars Table 12.11 Best responses for Ki-Adi in the sword game Table 12.12 Best responses for Asajj in the sword game Table 12.13 Expected utility for Ki-Adi in the asymmetric sword game Table 12.14 Expected utility for Asajj in the asymmetric sword game Figure A.5 Adding multiple plots and reference lines to a single graph One last type of graph that will be useful as you move along the book is a bar graph As the name suggests, in a bar graph, a list of numerical values of variables are represented by the height of rectangles of equal width The function barplot() can be used to create a bar chart in R (see Figure A.6): Figure A.6 Example of a barplot in R A.9 Iterators When the same operation needs to be repeated a large enough number of times, sequentially inputing the commands by hand is impractical Vectorization sometimes offers a way to deal with these situations, but it is not always possible or practical For example, when the outcome of one iteration depends on the results from previous ones, vectorization is usually not helpful Loops provide a flexible alternative to deal with iterated operations To motivate loops, consider creating a matrix with 10 rows, each corresponding to sequences of integers, all with the same starting value but different increments (increments of for the first row, increments of for the second, etc.) This can be achieved using the following code: Note that the 2nd to the 11th instructions are structurally identical They only differ on two features: the index of the row increases and the by argument changes to reflect the desired increment in the sequence for loops allow you to accomplish the same task without having to write one separate instruction for each row of the matrix for loops, which allow you to repeat the same set of instructions a fixed number times, have the following syntax: for(counter in vector){ block of instructions to be repeated } The counter, which is defined within the parentheses that follow the for instruction, is a variable that sequentially takes the values contained in vector Roughly speaking, this is the variable that tells you how many times the operations are going to be repeated On the other hand, a set of instructions that are going to be repeated, once for every value in vector, are located within the curly brackets that follow the parentheses As an example, the following code uses a for loop to complete the task of filling out the rows of a matrix with different sequences of numbers: Iterations of a loop can depend on the result of previous iterations For example, consider computing the first 20 terms of the Fibonacci sequenceA.1 : loops are an alternative to for loops Rather than being executed a fixed number of times, while loops are executed indefinitely until a given condition is satisfied The syntax for a while loop is while while(condition){ block of instructions to be repeated } The expression that replaces the placeholder condition must result in a single logical value (while loops are not vectorized) As before, the block of instructions that will be repeated until the condition is satisfied is placed between curly brackets The condition associated with a while loop is checked before each iteration is executed Hence, if the condition is not satisfied before the loop starts, the instructions inside are never executed As an example of the use of while loops, consider the problem of generating the first term of the Fibonacci sequence that is greater than 1000 (recall from our previous example that the value of such a term is 1597) Since we not necessarily know in advance how many terms will need to be computed, we use a while loop that checks on the value of the Fibonacci sequence after each iteration and terminates if the current term is greater than 1000 A.10 Selection and Forking You might sometimes find that different pieces of your code need to be executed depending on whether specific conditions are satisfied For example, you might want to set the value of a variable differently depending on whether another variable is positive or negative if/else statements allow you to accomplish this goal The syntax for an if/else loop is if(condition){ block of instructions if condition is TRUE }else{ block of instructions if condition is FALSE } As with a while loop, the expression that replaces the placeholder condition must result in a single logical value Depending on whether condition is TRUE or FALSE, only the top (or bottom) block of instructions will be executed If an else statement is not included, then no instructions are executed when condition is FALSE The following code shows an example of conditional execution: if/else statements can be particularly useful in conjunction with for and while loops The function ifelse() is a vectorized version of the if/else, but we will rarely use it in this book A.11 Other Things to Keep in Mind Once you have finished with your work, you can save all of it by using the option Save Workspace File… in the Workspace menu This will prompt a window where you can type a name for the workspace and select a folder where it will be stored To load the workspace at a later time, you can either double click on the workspace file or use the option Load Workspace File… in the same Workspace menu One of the key features of R is its extendibility A number of authors have developed groups of specialized functions that are distributed in the form of “packages” A large number of packages are available from the CRAN website In this book, we employ the “prob”' package developed by G Jay Kern at Youngstown State University To install the package, you can use the Package Installer option of the Packages & Data menu Alternatively, you can use the install.packages() function from the command line In either case, you will see a number of messages associated with the installation appear in the command windows In most circumstances, you can ignore these messages Once the package has been installed, you will need to load it at the beginning of every R session by using the library() function: Failing to load the package before using any of its functions is a common source of errors and confusion Please not forget to so! A.1 The Fibonacci sequence has featured prominently in a number of movies as TV shows (including the Da Vinci code) Each term is constructed by adding together the previous two terms The two initial terms of the recursion are both equal to Index a Allais paradox All in bets asymmetric games b backward induction algorithm Bayes theorem Bernoulli trials best response bets color even inside odd outside split straight-up street binomial distribution blackjack blinds bring-in c call card counting centipede game Chebyshev's theorem combinations come-out roll community card poker complement compound event counting systems crapping out croupier d D'Alembert system dominant strategy dominated strategies don't pass line double-down draw poker e Ellsberg's paradox equiprobable spaces expectation experiment extensive form f factorial fair bet game value of a bet first-mover advantage five-card draw the flop flush royal straight fold forced bets four-of-a-kind full-house g gambling systems game of chicken games random sequential simultaneous strategic theory geometric distribution geometric sums h hit house advantage i insurance in the hole j joint probability k keno l Labouchere system law of large numbers Let's make a deal m martingale doubling system minimax theorem mixed strategies Monty Hall paradox multiplication principle of counting multiplication rule multi-roll bets n Nash equilibria natural negative binomial distribution non-zero sum games normal form o odds losing payoff winning outcome space p pass line bet payout perfect information permutations pocket pair point prisoner's dilemma probability freqentist subjective profit pure strategies push r raise random variable rationality, assumption reduced game the river rock-paper-scissors roshambo roulette American European royal flush s second-mover advantage seven out shoe shooter single pair single-roll bets snake eyes soft number solution of a game split stand-by stay stiff hand straight flush strategic zero-sum games stud poker Superlotto surrender symmetric game t Texas hold'em three-of-a-kind total probability law the turn u utility, functions v variance y Yo WILEY END USER LICENSE AGREEMENT Go to www.wiley.com/go/eula to access Wiley's ebook EULA ... both strategic and random games For example, poker incorporates elements of random games (cards are dealt at random) with those of a sequential strategic game (betting is made in rounds and “bluffing”... problems From the point of view of the mathematical tools used for their analysis, games can be broadly divided between random games and strategic games Random games pit one or more players against... To Sabrina Abel To my family Bruno Preface Why Gambling and Gaming? Games are a universal part of human experience and are present in almost every culture; the earliest games known (such as senet

Ngày đăng: 04/03/2019, 10:27

TỪ KHÓA LIÊN QUAN