Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Probability Mass Function (PMF) 2/2 | Probability Functions
Probability Theory Update

Svep för att visa menyn

book
Probability Mass Function (PMF) 2/2

Probability mass function over a range:

In some cases, we want to know the probability that discrete random variables are equal to numbers over a range.

Example:

Calculate the probability that we will have success with the fair coin at 4 or less times (0, 1, 2, 3 or 4) (the chance of getting head or tail is 50%) if we have 15 attempts. We assume that success means getting a head.

Python realization:

12345678910111213141516171819202122232425262728293031
# Import required library import scipy.stats as stats # The probability of getting 0 successes prob_0 = stats.binom.pmf(0, n = 15, p = 0.5) # The probability of getting 1 success prob_1 = stats.binom.pmf(1, n = 15, p = 0.5) # The probability of getting 2 successes prob_2 = stats.binom.pmf(2, n = 15, p = 0.5) # The probability of getting 3 successes prob_3 = stats.binom.pmf(3, n = 15, p = 0.5) # The probability of getting 4 successes prob_4 = stats.binom.pmf(4, n = 15, p = 0.5) # The resulting probability probability = prob_0 + prob_1 + prob_2 + prob_3 + prob_4 print("The probability is", probability * 100, "%")
copy

Explanation

We've found the probability that a discrete random variable will equal exactly 0, 1, 2, 3, or 4 using the probability mass function. Then, we summed up all probabilities using the addition rule because each of the found outcomes was permissible for us.

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 4. Kapitel 3
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

Awesome!

Completion rate improved to 3.7

book
Probability Mass Function (PMF) 2/2

Probability mass function over a range:

In some cases, we want to know the probability that discrete random variables are equal to numbers over a range.

Example:

Calculate the probability that we will have success with the fair coin at 4 or less times (0, 1, 2, 3 or 4) (the chance of getting head or tail is 50%) if we have 15 attempts. We assume that success means getting a head.

Python realization:

12345678910111213141516171819202122232425262728293031
# Import required library import scipy.stats as stats # The probability of getting 0 successes prob_0 = stats.binom.pmf(0, n = 15, p = 0.5) # The probability of getting 1 success prob_1 = stats.binom.pmf(1, n = 15, p = 0.5) # The probability of getting 2 successes prob_2 = stats.binom.pmf(2, n = 15, p = 0.5) # The probability of getting 3 successes prob_3 = stats.binom.pmf(3, n = 15, p = 0.5) # The probability of getting 4 successes prob_4 = stats.binom.pmf(4, n = 15, p = 0.5) # The resulting probability probability = prob_0 + prob_1 + prob_2 + prob_3 + prob_4 print("The probability is", probability * 100, "%")
copy

Explanation

We've found the probability that a discrete random variable will equal exactly 0, 1, 2, 3, or 4 using the probability mass function. Then, we summed up all probabilities using the addition rule because each of the found outcomes was permissible for us.

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

close

Awesome!

Completion rate improved to 3.7

Svep för att visa menyn

some-alt