Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Solving Task Using Poisson Distribution | Commonly Used Discrete Distributions
Probability Theory Basics

book
Challenge: Solving Task Using Poisson Distribution

Taak

Swipe to start coding

In a city, car accidents occur on average 12 times from 8 am to 8 pm daily. What is the probability of observing exactly 4 car accidents from 8 am to 12 pm on a randomly chosen day?

You have to:

  1. Calculate desired_mu, which will represent the average number of accidents during the desired period of time.
  2. Calculate the corresponding probability using the Poisson distribution.

Oplossing

from scipy.stats import poisson

# Parameters
mu = 12 # Average number of car accidents from 8 am to 8 pm
k = 4 # Number of car accidents to calculate the probability for

# Calculate new mu for desired period of time: from 8 am to 12 pm
desired_mu = mu / 3
# Calculate the probability using the Poisson distribution
probability = poisson.pmf(k, desired_mu)

# Print the result
print(f'The probability of observing exactly {k} car accidents is {probability:.4f}')

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6
from scipy.stats import poisson

# Parameters
mu = 12 # Average number of car accidents from 8 am to 8 pm
k = 4 # Number of car accidents to calculate the probability for

# Calculate new mu for desired period of time: from 8 am to 12 pm
desired_mu = mu / ___
# Calculate the probability using the Poisson distribution
probability = poisson.___(k, desired_mu)

# Print the result
print(f'The probability of observing exactly {k} car accidents is {probability:.4f}')
toggle bottom row
some-alt