diff --git a/ipynb/ProbabilityParadox.ipynb b/ipynb/ProbabilityParadox.ipynb index 56ed36c..2a3e82c 100644 --- a/ipynb/ProbabilityParadox.ipynb +++ b/ipynb/ProbabilityParadox.ipynb @@ -2249,7 +2249,7 @@ } }, "source": [ - "A table and a plot will give a feel for the `util` function. Notice the characteristics concave-down shape of the plot." + "A table and a plot will give a feel for the `util` function. Notice the characterisitc concave-down shape of the plot." ] }, { @@ -3094,7 +3094,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.3" + "version": "3.7.0" } }, "nbformat": 4, diff --git a/ipynb/ProbabilitySimulation.ipynb b/ipynb/ProbabilitySimulation.ipynb index eeccc20..3e3ad0c 100644 --- a/ipynb/ProbabilitySimulation.ipynb +++ b/ipynb/ProbabilitySimulation.ipynb @@ -485,7 +485,7 @@ "- $A$, $B$: the cutoff values they choose: the lower bound of the range of first numbers they will accept.\n", "- $a$, $b$: the actual random numbers that appear on the screen.\n", "\n", - "For example, if player** A** chooses a cutoff of $A$ = 0.6, that means that** A** would accept any first number greater than 0.6, and reject any number below that cutoff. The question is: What cutoff, $A$, should player** A** choose to maximize the chance of winning, that is, maximize P($a$ > $b$)?\n", + "For example, if player **A** chooses a cutoff of $A$ = 0.6, that means that **A** would accept any first number greater than 0.6, and reject any number below that cutoff. The question is: What cutoff, $A$, should player **A** choose to maximize the chance of winning, that is, maximize P($a$ > $b$)?\n", "\n", "First, simulate the number that a player with a given cutoff gets (note that `random.random()` returns a float sampled uniformly from the interval [0..1]):" ] @@ -630,11 +630,11 @@ "\n", "## The Hot New Game Show Problem: Exact Calculation\n", "\n", - "More promising is the possibility of making `Pwin(A, B)` an exact calculation. But before we get to `Pwin(A, B)`, let's solve a simpler problem: assume that both players** A** and** B** have chosen a cutoff, and have each received a number above the cutoff. What is the probability that** A** gets the higher number? We'll call this `Phigher(A, B)`. We can think of this as a two-dimensional sample space of points in the ($a$, $b$) plane, where$a$ ranges from the cutoff $A$ to 1 and $b$ ranges from the cutoff B to 1. Here is a diagram of that two-dimensional sample space, with the cutoffs $A$=0.5 and $B$=0.6:\n", + "More promising is the possibility of making `Pwin(A, B)` an exact calculation. But before we get to `Pwin(A, B)`, let's solve a simpler problem: assume that both players **A** and **B** have chosen a cutoff, and have each received a number above the cutoff. What is the probability that **A** gets the higher number? We'll call this `Phigher(A, B)`. We can think of this as a two-dimensional sample space of points in the ($a$, $b$) plane, where$a$ ranges from the cutoff $A$ to 1 and $b$ ranges from the cutoff B to 1. Here is a diagram of that two-dimensional sample space, with the cutoffs $A$=0.5 and $B$=0.6:\n", "\n", "\n", "\n", - "The total area of the sample space is 0.5 × 0.4 = 0.20, and in general it is (1 - $A$) · (1 - $B$). What about the favorable cases, where** A** beats** B**? That corresponds to the shaded triangle below:\n", + "The total area of the sample space is 0.5 × 0.4 = 0.20, and in general it is (1 - $A$) · (1 - $B$). What about the favorable cases, where **A** beats **B**? That corresponds to the shaded triangle below:\n", "\n", "\n", "\n", @@ -694,16 +694,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We're now ready to tackle the full game. There are four cases to consider, depending on whether** A** and** B** gets a first number that is above or below their cutoff choices:\n", + "We're now ready to tackle the full game. There are four cases to consider, depending on whether **A** and **B** gets a first number that is above or below their cutoff choices:\n", "\n", - "| first $a$ | first $b$ | P($a$, $b$) | P(A wins | $a$, $b$) | Comment |\n", + "| first $a$ | first $b$ | P($a$, $b$) | P(A wins│ $a$, $b$) | Comment |\n", "|:-----:|:-----:| ----------- | ------------- | ------------ |\n", "|$a$ > $A$ | $b$ > $B$ | (1 - $A$) · (1 - $B$) | Phigher(*A*, $B$) | Both above cutoff; both keep first numbers |\n", "|$a$ < $A$ | $b$ < $B$ | $A$ · $B$ | Phigher(0, 0) | Both below cutoff, both get new numbers from [0..1] |\n", - "|$a$ > $A$ | $b$ < $B$ | (1 - $A$) · $B$ | Phigher(*A*, 0) |** A** keeps number;** B** gets new number from [0..1] |\n", - "|$a$ < $A$ | $b$ > $B$ | $A$ · (1 - $B$) | Phigher(0, $B$) |** A** gets new number from [0..1];** B** keeps number |\n", + "|$a$ > $A$ | $b$ < $B$ | (1 - $A$) · $B$ | Phigher($A$, 0) | **A** keeps number; **B** gets new number from [0..1] |\n", + "|$a$ < $A$ | $b$ > $B$ | $A$ · (1 - $B$) | Phigher(0, $B$) | **A** gets new number from [0..1]; **B** keeps number |\n", "\n", - "For example, the first row of this table says that the event of both first numbers being above their respective cutoffs has probability (1 - $A$) · (1 - $B$), and if this does occur, then the probability of** A** winning is Phigher(*A*, $B$).\n", + "For example, the first row of this table says that the event of both first numbers being above their respective cutoffs has probability (1 - $A$) · (1 - $B$), and if this does occur, then the probability of **A** winning is Phigher(*A*, $B$).\n", "We're ready to replace the old simulation-based `Pwin` with a new calculation-based version:" ] }, @@ -936,7 +936,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "What does this [Pringle of Probability](http://fivethirtyeight.com/features/should-you-shoot-free-throws-underhand/) show us? The highest win percentage for** A**, the peak of the surface, occurs when $A$ is around 0.5 and $B$ is 0 or 1. We can confirm that, finding the maximum `Pwin(A, B)` for many different cutoff values of `A` and `B`:" + "What does this [Pringle of Probability](http://fivethirtyeight.com/features/should-you-shoot-free-throws-underhand/) show us? The highest win percentage for **A**, the peak of the surface, occurs when $A$ is around 0.5 and $B$ is 0 or 1. We can confirm that, finding the maximum `Pwin(A, B)` for many different cutoff values of `A` and `B`:" ] }, { @@ -1004,7 +1004,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "And what if we run it the other way around, where** B** chooses a cutoff first, and then** A** responds?" + "And what if we run it the other way around, where **B** chooses a cutoff first, and then **A** responds?" ] }, { @@ -1033,7 +1033,7 @@ "metadata": {}, "source": [ "In both cases, the rational choice for both players is a cutoff of 0.618034, which corresponds to the \"saddle point\" in the middle of the plot. This is a *stable equilibrium*; consider fixing $B$ = 0.618034, \n", - "and notice that if $A$ changes to any other value, we slip off the saddle to the right or left, resulting in a worse win probability for** A**. Similarly, if we fix $A$ = 0.618034, then if $B$ changes to another value, we ride up the saddle to a higher win percentage for** A**, which is worse for** B**. So neither player will want to move from the saddle point.\n", + "and notice that if $A$ changes to any other value, we slip off the saddle to the right or left, resulting in a worse win probability for **A**. Similarly, if we fix $A$ = 0.618034, then if $B$ changes to another value, we ride up the saddle to a higher win percentage for **A**, which is worse for **B**. So neither player will want to move from the saddle point.\n", "\n", "The moral for continuous spaces is the same as for discrete spaces: be careful about defining your sample space; measure carefully, and let your code take care of the rest." ]