[PYTHON] [Statistics for programmers] Conditional probabilities and multiplication theorems

table of contents

Statistics for Programmers-Table of Contents

What is conditional probability?

The probability that event A will occur under the condition that event B will occur is called the conditional probability. It can be calculated by the following formula. Conditional probability = Probability of A and B occurring / Probability of B occurring

P(A|B) = \frac{P(A∩B)}{P(B)}

example

Shake the dice twice to calculate the probability that the sum of the rolls will be 8 or more. However, "4" will always appear the first time.

In this case, the following equation holds.

Conditional probability= \frac{(1st time is 4∩ 1st time and 2nd time is 8)}{The first time is 4}

The probability of becoming 4 the first time is

\frac{1}{6}

is.

The probability that the first time is 4 and the total of the first time and the second time is 8 Since it is calculated by the probability of becoming 4 x the probability of getting any of 4,5,6, it can be calculated by the following formula.

\frac{1}{12} = \frac{1}{6}\times\frac{3}{6}

Applying these to the formula I wrote at the beginning,

\frac{1}{2} = \frac{\frac{1}{12}}{\frac{1}{6}}

The answer is 1/2. In other words, the conditional probability of this example is 50%.

Independence

Event A and Event B are said to be "independent" when Event B does not affect Event A, even if there is a condition that Event B occurs.

P(A|B) = P(A)

Exclusion

If event A does not occur when event B occurs, then event A and event B are said to be "exclusions".

P(A|B) = 0

Multiplication theorem

The multiplication theorem is a transformation of the formula for obtaining conditional probabilities as follows.

P(A∩B) = P(A) \times P(A|B)

example

Suppose you have 10 lots and 4 wins. After Mr. A wins, Mr. B draws a lottery. What is the probability that both Mr. A and Mr. B will win?

Probability of hitting Mr. A= \frac{4}{10}
Probability of hitting Mr. B= \frac{3}{9}

So the answer is 2/15.

\frac{2}{15} = \frac{4}{10} \times \frac{3}{9}

reference

-What is conditional probability

Recommended Posts

[Statistics for programmers] Conditional probabilities and multiplication theorems
[Statistics for programmers] Lorenz curve and Gini coefficient
[Statistics for programmers] Bayes' theorem
[Statistics for programmers] Box plot
[Statistics for programmers] Variance, standard deviation and coefficient of variation
[Statistics for programmers] Random variables, probability distributions, and probability density functions
[Statistics for programmers] Mean, median, mode
[Statistics for programmers] What is an event?
[Statistics for Programmers] Table of Contents-Data Science
Fuzzing and statistics