What are the chances?

Introdução à estatística

George Boorman

Curriculum Manager, DataCamp

Measuring chance

What's the probability of an event?

$$ P(\text{event}) = \frac{\text{\# ways event can happen}}{\text{total \# of possible outcomes}} $$

Example: a coin flip

$$ P(\text{heads}) = \frac{\text{1 way to get heads}}{\text{2 possible outcomes}} = \frac{1}{2} = 50\%$$

line of probability from left where 0 percent = impossible, to right where 100 percent = will certainly happen.png

Introdução à estatística

Assigning salespeople

Box with Amir, Brian, Claire, and Damian's names.png

  • Sampling
Introdução à estatística

Assigning salespeople

Pulling out Brian's name from the box.png

$$P(\text{Brian}) = \frac{1}{4} = 25\%$$

Introdução à estatística

Morning meeting

Pulling out Brian's name from the box.png

Introdução à estatística

Afternoon meeting

Pulling out Brian's name from the box.png

$$P(\text{Brian}) = \frac{1}{4} = 25\%$$

  • Sampling with replacement
Introdução à estatística

Independent probability

Two events are independent if the probability of the second event does not change based on the outcome of the first event.

Introdução à estatística

Online retail sales

Order Number Product Type Net Quantity Gross Sales Discounts Returns Net Sales
200 Basket 13 3744.0 -316.80 0.00 3427.20
201 Basket 12 3825.0 -201.60 -288.0 3335.40
202 Basket 17 3035.0 -63.25 0.00 2971.75
203 Art & Sculpture 47 2696.8 -44.16 0.00 2652.64
204 Basket 17 2695.0 -52.50 -110.00 2532.50

wooden_baskets.jpg

1 Image credit: https://unsplash.com/@rodriguezedm
Introdução à estatística

Probability of an order for a jewelry product

Product Type Order Count
Basket 551
Art & Sculpture 337
Jewelry 210
Kitchen 161
Home Decor 131
... ...
Total 1767
Introdução à estatística

Probability of an order for a jewelry product

$$P(Jewelry) = \frac{Order \ Count(Jewelry)}{Sum(Total \ Order \ Count)}$$

$$P(Jewelry) = \frac{210}{1767}$$

$$P(Jewelry) = 11.88 \%$$

Introdução à estatística

Probabilities for all product types

Product Type Order Count Probability
Basket 551 31.18%
Art & Sculpture 337 19.07%
Jewelry 210 11.88%
Kitchen 161 9.11%
Home Decor 131 7.41%
... ... ...
Total 1767 100%
Introdução à estatística

Let's practice!

Introdução à estatística

Preparing Video For Download...