From cd0822c5bdd9aa6e26f76a50a52e89dfcc5e7650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Oviedo?= Date: Wed, 6 Oct 2021 14:58:23 -0400 Subject: [PATCH 1/2] update --- .../.ipynb_checkpoints/main-checkpoint.ipynb | 233 ++++++++++++++++++ your-code/main.ipynb | 190 ++++++++++++-- 2 files changed, 399 insertions(+), 24 deletions(-) create mode 100644 your-code/.ipynb_checkpoints/main-checkpoint.ipynb diff --git a/your-code/.ipynb_checkpoints/main-checkpoint.ipynb b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb new file mode 100644 index 0000000..c5df1ec --- /dev/null +++ b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb @@ -0,0 +1,233 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Intro to Bayesian Statistics Lab\n", + "\n", + "Complete the following set of exercises to solidify your knowledge of Bayesian statistics and Bayesian data analysis." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1. Cookie Problem\n", + "\n", + "Suppose we have two bowls of cookies. Bowl 1 contains 30 vanilla cookies and 10 chocolate cookies. Bowl 2 contains 20 of each. You randomly pick one cookie out of one of the bowls, and it is vanilla. Use Bayes Theorem to calculate the probability that the vanilla cookie you picked came from Bowl 1?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "bowl_1_vanilla = 30/40\n", + "bowl_2_vanilla = 20/40\n", + "o\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What is the probability that it came from Bowl 2?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What if the cookie you had picked was chocolate? What are the probabilities that the chocolate cookie came from Bowl 1 and Bowl 2 respectively?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2. Candy Problem\n", + "\n", + "Suppose you have two bags of candies:\n", + "\n", + "- In Bag 1, the mix of colors is:\n", + " - Brown - 30%\n", + " - Yellow - 20%\n", + " - Red - 20%\n", + " - Green - 10%\n", + " - Orange - 10%\n", + " - Tan - 10%\n", + " \n", + "- In Bag 2, the mix of colors is:\n", + " - Blue - 24%\n", + " - Green - 20%\n", + " - Orange - 16%\n", + " - Yellow - 14%\n", + " - Red - 13%\n", + " - Brown - 13%\n", + " \n", + "Not knowing which bag is which, you randomly draw one candy from each bag. One is yellow and one is green. What is the probability that the yellow one came from the Bag 1?\n", + "\n", + "*Hint: For the likelihoods, you will need to multiply the probabilities of drawing yellow from one bag and green from the other bag and vice versa.*" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What is the probability that the yellow candy came from Bag 2?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What are the probabilities that the green one came from Bag 1 and Bag 2 respectively?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 3. Monty Hall Problem\n", + "\n", + "Suppose you are a contestant on the popular game show *Let's Make a Deal*. The host of the show (Monty Hall) presents you with three doors - Door A, Door B, and Door C. He tells you that there is a sports car behind one of them and if you choose the correct one, you win the car!\n", + "\n", + "You select Door A, but then Monty makes things a little more interesting. He opens Door B to reveal that there is no sports car behind it and asks you if you would like to stick with your choice of Door A or switch your choice to Door C. Given this new information, what are the probabilities of you winning the car if you stick with Door A versus if you switch to Door C?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 4. Bayesian Analysis \n", + "\n", + "Suppose you work for a landscaping company, and they want to advertise their service online. They create an ad and sit back waiting for the money to roll in. On the first day, the ad sends 100 visitors to the site and 14 of them sign up for landscaping services. Create a generative model to come up with the posterior distribution and produce a visualization of what the posterior distribution would look like given the observed data." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Produce a set of descriptive statistics for the posterior distribution." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What is the 90% credible interval range?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "What is the Maximum Likelihood Estimate?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.6" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 95bfcb9..6fbbb96 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -31,10 +31,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "0.6" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "vanilla_bowl_1 = 30/40\n", + "vanilla_bowl_2 = 20/40\n", + "bowl_1 = 0.5\n", + "bowl_2 = 0.5\n", + "\n", + "bowl_1_vanilla = bowl_1 * vanilla_bowl_1 / (bowl_1 * vanilla_bowl_1 + bowl_2 * vanilla_bowl_2)\n", + "bowl_1_vanilla" + ] }, { "cell_type": "markdown", @@ -45,10 +64,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "0.4" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bowl_2_vanilla = 1 - bowl_1_vanilla\n", + "bowl_2_vanilla" + ] }, { "cell_type": "markdown", @@ -59,10 +92,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "0.3333333333333333" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "chocolate_bowl_1 = 10/40\n", + "chocolate_bowl_2 = 20/40\n", + "bowl_1 = 0.5\n", + "bowl_2 = 0.5\n", + "\n", + "bowl_1_chocolate = bowl_1 * chocolate_bowl_1 / (bowl_1 * chocolate_bowl_1 + bowl_2 * chocolate_bowl_2)\n", + "bowl_1_chocolate" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.6666666666666667" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bowl_2_chocolate = 1 - bowl_1_chocolate\n", + "bowl_2_chocolate" + ] }, { "cell_type": "markdown", @@ -95,10 +168,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag 1 given yellow: 0.5882352941176471\n" + ] + } + ], + "source": [ + "bag_1 = 0.5\n", + "bag_2 = 0.5\n", + "yellow_bag_1 = 0.2\n", + "yellow_bag_2 = 0.14\n", + "\n", + "bag_1_yellow = bag_1 * yellow_bag_1 / (bag_1 * yellow_bag_1 + bag_2 * yellow_bag_2)\n", + "print('Bag 1 given yellow: ', bag_1_yellow)" + ] }, { "cell_type": "markdown", @@ -109,10 +198,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag 2 given yellow: 0.4117647058823529\n" + ] + } + ], + "source": [ + "bag_2_yellow = 1 - bag_1_yellow\n", + "print('Bag 2 given yellow: ', bag_2_yellow)" + ] }, { "cell_type": "markdown", @@ -123,10 +223,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag 1 given Green: 0.3333333333333333\n", + "Bag 2 given Green: 0.6666666666666667\n" + ] + } + ], + "source": [ + "bag_1 = 0.5\n", + "bag_2 = 0.5\n", + "green_bag_1 = 0.1\n", + "green_bag_2 = 0.2\n", + "\n", + "bag_1_green = bag_1 * green_bag_1 / (bag_1 * green_bag_1 + bag_2 * green_bag_2)\n", + "print('Bag 1 given Green: ', bag_1_green)\n", + "\n", + "bag_2_green = 1 - bag_1_green\n", + "print('Bag 2 given Green: ', bag_2_green)" + ] }, { "cell_type": "markdown", @@ -141,10 +261,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "0.6666666666666666" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "inA = 1/3\n", + "inB = 1/3\n", + "inC = 1/3\n", + "\n", + "prob_notinB_inA = 1\n", + "prob_notinB_inB = 0\n", + "prob_notinB_inC = 1/2\n", + "\n", + "prob_inA_notinB = prob_notinB_inA * inA / (prob_notinB_inA * inA + prob_notinB_inB * inB + prob_notinB_inC * inC)\n", + "prob_inA_notinB" + ] }, { "cell_type": "markdown", @@ -207,7 +349,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -221,7 +363,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.9.6" } }, "nbformat": 4, From be59f58292910e7fe43d76e60773114bd46dab4a Mon Sep 17 00:00:00 2001 From: Saul Oviedo Date: Sun, 10 Oct 2021 14:03:08 -0400 Subject: [PATCH 2/2] finish --- .../.ipynb_checkpoints/main-checkpoint.ipynb | 285 ++++++++++++++++-- your-code/main.ipynb | 119 ++++++-- 2 files changed, 352 insertions(+), 52 deletions(-) diff --git a/your-code/.ipynb_checkpoints/main-checkpoint.ipynb b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb index c5df1ec..176af3e 100644 --- a/your-code/.ipynb_checkpoints/main-checkpoint.ipynb +++ b/your-code/.ipynb_checkpoints/main-checkpoint.ipynb @@ -31,13 +31,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "0.6" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "bowl_1_vanilla = 30/40\n", - "bowl_2_vanilla = 20/40\n", - "o\n" + "vanilla_bowl_1 = 30/40\n", + "vanilla_bowl_2 = 20/40\n", + "bowl_1 = 0.5\n", + "bowl_2 = 0.5\n", + "\n", + "bowl_1_vanilla = bowl_1 * vanilla_bowl_1 / (bowl_1 * vanilla_bowl_1 + bowl_2 * vanilla_bowl_2)\n", + "bowl_1_vanilla" ] }, { @@ -49,10 +64,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "0.4" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bowl_2_vanilla = 1 - bowl_1_vanilla\n", + "bowl_2_vanilla" + ] }, { "cell_type": "markdown", @@ -63,10 +92,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "0.3333333333333333" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "chocolate_bowl_1 = 10/40\n", + "chocolate_bowl_2 = 20/40\n", + "bowl_1 = 0.5\n", + "bowl_2 = 0.5\n", + "\n", + "bowl_1_chocolate = bowl_1 * chocolate_bowl_1 / (bowl_1 * chocolate_bowl_1 + bowl_2 * chocolate_bowl_2)\n", + "bowl_1_chocolate" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.6666666666666667" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bowl_2_chocolate = 1 - bowl_1_chocolate\n", + "bowl_2_chocolate" + ] }, { "cell_type": "markdown", @@ -99,10 +168,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag 1 given yellow: 0.5882352941176471\n" + ] + } + ], + "source": [ + "bag_1 = 0.5\n", + "bag_2 = 0.5\n", + "yellow_bag_1 = 0.2\n", + "yellow_bag_2 = 0.14\n", + "\n", + "bag_1_yellow = bag_1 * yellow_bag_1 / (bag_1 * yellow_bag_1 + bag_2 * yellow_bag_2)\n", + "print('Bag 1 given yellow: ', bag_1_yellow)" + ] }, { "cell_type": "markdown", @@ -113,10 +198,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag 2 given yellow: 0.4117647058823529\n" + ] + } + ], + "source": [ + "bag_2_yellow = 1 - bag_1_yellow\n", + "print('Bag 2 given yellow: ', bag_2_yellow)" + ] }, { "cell_type": "markdown", @@ -127,10 +223,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag 1 given Green: 0.3333333333333333\n", + "Bag 2 given Green: 0.6666666666666667\n" + ] + } + ], + "source": [ + "bag_1 = 0.5\n", + "bag_2 = 0.5\n", + "green_bag_1 = 0.1\n", + "green_bag_2 = 0.2\n", + "\n", + "bag_1_green = bag_1 * green_bag_1 / (bag_1 * green_bag_1 + bag_2 * green_bag_2)\n", + "print('Bag 1 given Green: ', bag_1_green)\n", + "\n", + "bag_2_green = 1 - bag_1_green\n", + "print('Bag 2 given Green: ', bag_2_green)" + ] }, { "cell_type": "markdown", @@ -145,10 +261,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "0.3333333333333333" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "inA = 1/3\n", + "inB = 1/3\n", + "inC = 1/3\n", + "\n", + "prob_notinB_inA = 1\n", + "prob_notinB_inB = 0\n", + "prob_notinB_inC = 1/2\n", + "\n", + "prob_inA_notinB = prob_notinB_inC * inC / (prob_notinB_inA * inA + prob_notinB_inB * inB + prob_notinB_inC * inC)\n", + "prob_inA_notinB" + ] }, { "cell_type": "markdown", @@ -161,10 +299,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "image/png": "iVBORw0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avROPATwAPAhzvazwdebO63NtNbh/2cRqU+Td/ssJ/DiNToGuAHmunf7nidld+Heq3RKO9HwzxyX8klCnYBB5rpvwGujYgY4BiHrWuNMnMmM58Gvrdg3Q8Bj2XmtzLzNeAx4LpBDHqAeqnPZrGSGn0xM99sZh9n/nspsDn2IeitRiNrmOG+HXilY/5Y07boMpk5B7wO/FDTd2lE/EdE/GtE/Hy/BzskK6lRP9bdKHp9ju+LiMMR8XhE3LSuIxsdq63RncA/rHHdjaqXGsGI7kcb9ZeYTgA/mpmvRsQHgb+PiMsz89vDHpg2lEsy83hEXAb8S0QcycyvD3tQwxIRvwFMAr847LGMqiVqNJL70TCP3FdyiYJ3l4mILcD7gVcz863MfBUgM59g/nzZj/V9xIPXy2UcNsMlIHp6jpl5vLl/EWgDV67n4EbEimoUEb8EfAz41cx8azXrFtBLjUZ3PxrimxhbmH+D5lL+/02Myxcscxenv6H6UDN9AXBWM30Z8/8Q5w/7DYxh1Khj2fs58w3Vl5h/I2xrM12qRj3WZyvw3mZ6G/ACC95Eq3Bb4evsSuYPkHYsaC+/D61DjUZ2Pxp2UW8A/rsp2seatj9m/i8jwPuAvwaOAl8BLmvafx14FngKeBL4lWEXcog1+inmzxG+AbwKPNux7keb2h0F7hj2cxml+gA/AxxpXshHgDuH/VyGWKN/Bk42r6engIObaR/qpUajvB95+QFJKshvqEpSQYa7JBVkuEtSQYa7JBVkuEtSQYa7JBVkuEtSQf8HH3DYl6g9vH4AAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "def generative_model(proba_compra):\n", + " compraron = np.random.binomial(100, proba_compra)\n", + " return compraron\n", + "\n", + "n_draws = 100_000\n", + "prior = pd.Series(np.random.uniform(0,1,size=n_draws))\n", + "\n", + "compraron = list()\n", + "for equipo in prior:\n", + " compraron.append(generative_model(equipo))\n", + " \n", + "posteriori = prior[list(map(lambda x:x ==14, compraron))]\n", + "posteriori.hist();" + ] }, { "cell_type": "markdown", @@ -175,10 +340,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "count 968.000000\n", + "mean 0.145138\n", + "std 0.035227\n", + "min 0.055557\n", + "25% 0.120661\n", + "50% 0.143352\n", + "75% 0.166556\n", + "max 0.264835\n", + "dtype: float64" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "posteriori.describe()" + ] }, { "cell_type": "markdown", @@ -189,10 +375,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "(0.0911956419412086, 0.20786402954732147)" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "posteriori.quantile(0.05), posteriori.quantile(0.95)" + ] }, { "cell_type": "markdown", @@ -201,6 +400,26 @@ "What is the Maximum Likelihood Estimate?" ] }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.14513829347442303" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "posteriori.mean()" + ] + }, { "cell_type": "code", "execution_count": null, @@ -225,7 +444,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.5" } }, "nbformat": 4, diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 6fbbb96..176af3e 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -127,7 +127,7 @@ "0.6666666666666667" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -168,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -223,7 +223,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -261,16 +261,16 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "0.6666666666666666" + "0.3333333333333333" ] }, - "execution_count": 27, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -284,7 +284,7 @@ "prob_notinB_inB = 0\n", "prob_notinB_inC = 1/2\n", "\n", - "prob_inA_notinB = prob_notinB_inA * inA / (prob_notinB_inA * inA + prob_notinB_inB * inB + prob_notinB_inC * inC)\n", + "prob_inA_notinB = prob_notinB_inC * inC / (prob_notinB_inA * inA + prob_notinB_inB * inB + prob_notinB_inC * inC)\n", "prob_inA_notinB" ] }, @@ -299,10 +299,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAOVElEQVR4nO3df4xl9VnH8fcja1sEUxYXJ7ggA8lqsmQU2hGJPy/BWH5EF2NDIFh2KWaNQqJx/lntHzWaJvsPNWmi1DElLIktxR+VTUANrr02JtJ2QWSBimxhCLvZ7qYUaQcazNDHP+aAd2dn5s7Mnftjnnm/kpt7zvd7zj3f++y5nzl77r3nRmYiSarl+4Y9AEnS+jPcJakgw12SCjLcJakgw12SCtoy7AEAbNu2LcfHxxfte+ONNzjnnHMGO6ANxhp1Z42WZ326G8UaPfHEE9/MzAsW6xuJc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azXrFtBLjUZ3PxrimxhbmH+D5lL+/02Myxcscxenv6H6UDN9AXBWM30Z8/8Q5w/7DYxh1Khj2fs58w3Vl5h/I2xrM12qRj3WZyvw3mZ6G/ACC95Eq3Bb4evsSuYPkHYsaC+/D61DjUZ2Pxp2UW8A/rsp2seatj9m/i8jwPuAvwaOAl8BLmvafx14FngKeBL4lWEXcog1+inmzxG+AbwKPNux7keb2h0F7hj2cxml+gA/AxxpXshHgDuH/VyGWKN/Bk42r6engIObaR/qpUajvB95+QFJKshvqEpSQYa7JBVkuEtSQYa7JBVkuEtSQYa7JBVkuEtSQf8HH3DYl6g9vH4AAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "def generative_model(proba_compra):\n", + " compraron = np.random.binomial(100, proba_compra)\n", + " return compraron\n", + "\n", + "n_draws = 100_000\n", + "prior = pd.Series(np.random.uniform(0,1,size=n_draws))\n", + "\n", + "compraron = list()\n", + "for equipo in prior:\n", + " compraron.append(generative_model(equipo))\n", + " \n", + "posteriori = prior[list(map(lambda x:x ==14, compraron))]\n", + "posteriori.hist();" + ] }, { "cell_type": "markdown", @@ -313,10 +340,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "count 968.000000\n", + "mean 0.145138\n", + "std 0.035227\n", + "min 0.055557\n", + "25% 0.120661\n", + "50% 0.143352\n", + "75% 0.166556\n", + "max 0.264835\n", + "dtype: float64" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "posteriori.describe()" + ] }, { "cell_type": "markdown", @@ -327,10 +375,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "(0.0911956419412086, 0.20786402954732147)" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "posteriori.quantile(0.05), posteriori.quantile(0.95)" + ] }, { "cell_type": "markdown", @@ -339,6 +400,26 @@ "What is the Maximum Likelihood Estimate?" ] }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.14513829347442303" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "posteriori.mean()" + ] + }, { "cell_type": "code", "execution_count": null, @@ -363,7 +444,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.5" } }, "nbformat": 4,