Giter Site home page Giter Site logo

dsc-law-of-total-probability-lab-seattle-ds-012720's Introduction

Partitioning and Law of Total Probability - Lab

Introduction

In this lab, you'll practice your knowledge of the law of total probability. In probability theory, the law (or formula) of total probability is a fundamental rule relating marginal probabilities to conditional probabilities.

Objectives

You will be able to:

  • Differentiate between independent and dependent events
  • Perform partitioning based on known and unknown probabilities to solve a problem

Exercise 1

Imagine you have two hats: one has 4 red balls and 6 green balls, the other has 6 red and 4 green. We toss a fair coin, if heads, you will pick a random ball from the first hat, if tails you will pick one from the second hat.

What is the probability of getting a red ball?

# Your code here

Exercise 2

In games where at least one goal is made, a soccer team wins 60% of its games when it scores the first goal, and 10% of its games when the opposing team scores first.

If the team scores the first goal about 30% of the time, what fraction of the games does it win?

# Your code here

Exercise 3

In Europe, except for regular gas, cars often run on diesel as well. At a gas station in Paris;

  • 40% of the customers fill up with diesel (event G1)

  • 35% with gas "Super 95" (event G2)

  • 25% with gas "Super 98" (event G3).

  • 30% of the customers who buy diesel fill their tank completely (event F).

  • For "Super 95" and "Super 98", these numbers are 60% and 50%, respectively.

  • Compute the probability that the next customer completely fills their tank and buys Super 95.
  • Compute the probability that the next customer completely fills their tank
  • Given that the next customer fills their tank completely, compute the probability that they bought diesel.

Hint: Consult the theorems for conditional probability, check for dependence or independence of events

# Your code here

Exercise 4

United Airlines operates flights from JFK to Amsterdam, to Brussels, and to Copenhagen. As you may know, flights are overbooked fairly often. Let's denote the probability of the flight to Amsterdam being overbooked equal to 40%, the probability of the flight to Brussels being overbooked equal to 25%, and the probability of the flight to Copenhagen being overbooked equal to 35%. You can assume that these events of overbooking are independent events.

  • Compute the probability that all the flights are overbooked.
  • Compute the probability of having at least one flight which is not overbooked.
  • Compute the probability that exactly one flight is overbooked.
# Your code here

Exercise 5

You have three bags that each contain 100 marbles:

  • Bag 1 has 75 red and 25 blue marbles;
  • Bag 2 has 60 red and 40 blue marbles;
  • Bag 3 has 45 red and 55 blue marbles.

You choose one of the bags at random and then pick a marble from the chosen bag, also at random.

What is the probability that the chosen marble is red?

# Your code here

Summary

In this lab, you practiced conditional probability and its theorem with some simple problems. The key takeaway from this lab is to be able to identify random events as dependent or independent and calculating the probability of their occurrence using appropriate methods. Next, you'll take this knowledge a step further and run simulations with conditional and total probability.

dsc-law-of-total-probability-lab-seattle-ds-012720's People

Contributors

lmcm18 avatar loredirick avatar mas16 avatar shakeelraja 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  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.