Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Combine Your Knowledge | Conducting Fascinating Experiments
Probability Theory

book
Combine Your Knowledge

It is time to deal with three experiments; they are very similar, so firstly, let's recall some theory.

FunctionExplanation
binom.pmf(k, n, p)Calculate the probability to archive exactly k successes among n trials with the probability of success p
binom.sf(k, n, p)Calculate the probability to archive k or more successes among n trials with the probability of success p
binom.cdf(k, n, p)Calculate the probability to archive k or less successes among n trials with the probability of success p
Opgave

Swipe to start coding

Here, it would be best if we coped with several tasks.

  1. Calculate the probability that among 50 unique pictures, exactly 5 have a defect; the probability that a picture has a defect is 25%.
  2. Calculate the probability that at least 9(9 or more) employees are satisfied with their salary if we know that there are 20 workers in the project. The probability for the positive answer is 75% .
  3. Calculate the probability that 6 or fewer thefts this month will be revealed; we know that in the specific city, the amount of thefts is 10. The probability of revealing is 5%.

Løsning

from scipy.stats import binom

# Calculate the probability for pictures
experiment_1 = binom.pmf(k = 5, n = 50, p = 0.25)
# Calculate the probability for employees
experiment_2 = binom.sf(k = 9, n = 20, p = 0.75)
# Calculate the probability for thefts
experiment_3 = binom.cdf(k = 6, n = 10, p = 0.05)

# Print the probability for pictures
print("The probability is", experiment_1)
# Print the probability for employees
print("The probability is", experiment_2)
# Print the probability for thefts
print("The probability is", experiment_3)

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 4
from scipy.stats import binom

# Calculate the probability for pictures
experiment_1 = binom.___(k = 5, ___, p = ___)
# Calculate the probability for employees
experiment_2 = ___.sf(k = ___, n = ___, p = ___)
# Calculate the probability for thefts
experiment_3 = ___(___)

# Print the probability for pictures
print("The probability is", experiment_1)
# Print the probability for employees
print("The probability is", experiment_2)
# Print the probability for thefts
print("The probability is", experiment_3)
toggle bottom row
some-alt