GithubHelp home page GithubHelp logo

ds-uniform-distro-london-ds-062518's Introduction

The Uniform Probability Distribution

In the next few sections we will begin to investigate common probability distributions in order to better investigate random variables. This will allow us to choose appropriate mathematical models to reflect various real world observances. The most common of these probability distributions is the uniform distribution. Here, all values have equal probability of occurence. For example, rolling a dice is a discrete probability distribution with 6 possible outcomes (1-6). If it is a fair dice, then each of these outcomes has an equivalent probability of occuring and thus can be represented by a uniform distribution. Recall that this is a discrete case as there isn't a continuous variable that can take on values between 1 and 2 (or 2 and 3, 3 and 4, etc.).

In the continuous case, we define the density function of a uniform distributed random variable $y$ on the interval $(\theta_1, \theta_2)$ as:
$f(y) = \frac{1}{\theta_1 - \theta_2}$ where $\theta_1 <= y <= \theta_2$
and 0 everywhere else.

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

def uniform_density(theta_1, theta_2):
    """Theta1 is the lower bound of possible outcomes.
       Theta2 is the upper bound of all possible outcomes.
       We are assuming that no other values outside of these bounds are possible,
       and that all possabilities within those bounds have equal probability of occuring.
    """
    prob = 1/(theta_2 - theta_1)
    return prob

theta_1 = 0
theta_2 = 10
y = np.linspace(start=theta_1, stop=theta_2, num=10**3)
plt.plot(y, [uniform_density(theta_1, theta_2) for yi in y])
plt.title('Uniform Probability Density Function')
Text(0.5,1,'Uniform Probability Density Function')

png

Telephone Calls

A telephone line was overloaded for 30 seconds in a minute interval. If you called during this minute, what was the chance you got connected?

#Your code here

Landing

A parachuter lands at a random point between two markers A, and B. What is the probability that they are closer to A?

#Your code here

Landing 2

What is the probability that they are twice as close to A as to B?

# Your code here

Error

Sometimes error is modelled using a normal distribution. Other times a uniform distribution is used. In the case of cars, your spedometer is required to be accurate within 2.5% of the actual measurement. If your spedometer reads 70mph but and has an accuracy of +-2.5% with the errors uniformly distributed, what is the probability that you are actually driving slower then 70mph?

#Your code here

Error 2

Using the same problem context from above, what's the probability that you are driving 69mph or slower?

#Your code here

ds-uniform-distro-london-ds-062518's People

Contributors

mathymitchell avatar tkoar avatar

Watchers

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