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

Cursusinhoud

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 desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 4. Hoofdstuk 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 desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 4. Hoofdstuk 3
Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Onze excuses dat er iets mis is gegaan. Wat is er gebeurd?
some-alt