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

Kursusindhold

Probability Theory Update

Probability Theory Update

1. Probability Basics
2. Statistical Dependence
3. Learn Crucial Terms
4. Probability Functions
5. Distributions

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 desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 4. Kapitel 3
toggle bottom row

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 desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 4. Kapitel 3
Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Vi beklager, at noget gik galt. Hvad skete der?
some-alt