Coder Social home page Coder Social logo

ds-poisson-distro's Introduction

The Poisson Distribution

The poisson distribution has a special relation to the binomial distribution. The theoretical underpinnings are as follows. Imagine that we take a time period and break it into subintervals that are so small that at most one successful event could occur. We can then imagine that for any of these subintervals, a binomial distribution could apply where there is some probability of the event occuring p, a probability q=1-p that the event does not occur, and a probability of 0 that more then one event occurs. We assume that as we cut time into smaller and smaller intervals, the chance of a success should go down. If we take the limit of the binomial distribution as n goes to infinity (more and more subintervals that are progressively smaller), the result is the poisson distribution.

Binomial Probability Distribution:
$p(y) = \binom{n}{y}p^y(1-p)^{n-y}$

$\lambda = n*p$

Poisson Probability Distribution: $p(y) = \frac{\lambda^y}{y!}e^{-y}$

Also note that labmda is the now the average number of successes that we anticipate in a given interval. (The probability p of success, times n the number of intervals.) This is then exactly how the poisson is used in practice, if I know the average number of occurences in a given interval, what is the probability that the actual number of occurences is slightly more, slightly less, far more or far less?

Poisson Function

Write a function to calculate the probability that y events occur in a given interval given the average number of occurrences expected.

def poisson(y, mu):
    #Your code here
    return prob

Reinventing the Wheel

Check that your poisson function above works by checking its output for 1000 examples against scipys built in function:
scipy.stats.distributions.poisson.pmf

#Your code here

Mail

Let's say on average, you receive 4 pieces of mail per day. Draw a graph with the x-axis pieces of mail (0-20) and the y-axis the probabilitiy that you receive that many pieces of mail on a given day.

#Your code here

Home Runs

https://www.teamrankings.com/mlb/stat/home-runs-per-game

On average, the Yankees hit 1.47 home runs per game in 2017. What was the probability that they hit 2 home runs in a game? 3?

#Your code/answer here

Home Runs 2

In the same year, the Red Sox only had 1.04 home runs per game in 2017. What was the probability that they hit 2 home runs in a game? 3?

#Your code/answer here

Product Failures

Airplane tires need replacement after about 1500 flights. Let's assume that on an average day, an airline has to replace 2.34 tires per day. If you want to have a 95% confidence that you'll have enough tires for needed repairs, how many should be on stock? (We want to have enough, but storing tires is also expensive!)

#Your code/answer here

Product Failures 2

How many tires do you need on stock to have a 99% confidence that you'll have enough in stock? 99.9% confidence?

#Your code/answer here

ds-poisson-distro's People

Contributors

fpolchow avatar mathymitchell avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.