Giter VIP home page Giter VIP logo

urn-problems-probability's Introduction

Urn problems in probability

An urn problem is an exercise that involves questions about probability properties when extracting balls of various colors from one or more urns. For example, we may ask questions about the probability of certain sequences of extractions or about the inference of the proportion of balls of each color. We could also consider many different experimental settings (replacement vs. non-replacement after each draw, number of urns, number of ball colors, etc.).

Here, we will focus on the analysis via simulation of the convergence properties of the proportion of balls of one color under different rules. We will consider a single urn where we initially place a number $a$ of white balls and a number $b$ of black balls. Each time, we draw one ball and return it to the urn. However, depending on the type of ball drawn, we will add new balls to the urn according to some rule. After a large number of extractions and simulations, we will see where the proportion of white balls converges.

4 rules will be considered separately. We draw a ball, return it to the urn and then, we apply one of the following rules:

Rule A: If a white ball was drawn, a black ball is added to the urn. If a black ball was drawn, a white ball is added to the urn.

Rule B: The same total number of balls (6) is always added after each draw regardless of the color obtained. If a white ball was drawn, four white balls and two black balls are added. If a black ball was drawn, five white balls and one black ball are added.

Rule C: A different amount of balls is added to the urn after each extraction depending on the color obtained. If a white ball was drawn, two white balls and three black balls are added (5 in total). If a black ball was drawn, three white balls and four black balls are added (7 in total).

Rule D: (Pólya's urn) If a white ball was drawn, an extra white ball is added to the urn. If a black ball was drawn, an extra black ball is added to the urn.

To view the material on GitHub, click on the file urn-problems.md, whose contents are rendered correctly on this platform. If you want to run the code, download the notebook urn-problems.Rmd containing the R code chunks.

urn-problems-probability's People

Contributors

raulalmuzara avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.