Question: Please answer in Python Code taking into consideration the example output and Default Template. Thank you Default Template import numpy as np # import the

Please answer in Python Code taking into consideration the example output and Default Template. Thank you

Please answer in Python Code taking into consideration the example output and

Default Template

import numpy as np # import the correct module and function

x = int(input()) lam = int(input())

np.random.seed(seed=123)

# Generate 8 random numbers with a Poisson distribution with a mean of lam r1 = # Code for generating distribution

# Generate 20 random numbers with a Poisson distribution with a mean of lam r2 = # Code for generating distribution

# Generate 100 random numbers with a Poisson distribution with a mean of lam r3 = # Code for generating distribution

# Calculate the cumulative probability of x or fewer successes for a Poisson distribution with a mean of lam cp = # Code for cumulative probability print(f'Cumulative probability is {cp:.6f}')

# Calculate the theoretical mean of the Poisson distribution mean_theor = # Code for theoretical mean print("Theoretical mean is", mean_theor)

# Calculate the actual mean of r1, r2, and r3 mean_r1 = # Code for actual mean of r1 print(f'Mean of r1 is {mean_r1:.6f}')

mean_r2 = # Code for actual mean of r2 print(f'Mean of r2 is {mean_r2:.6f}')

mean_r3 = # Code for actual mean of r3 print(f'Mean of r3 is {mean_r3:.6f}')

The error I received when testing for the input 100 100

4.11 LAB: Poisson distribution - Generate a Poisson distribution r1 of 8 numbers with a user input mean, lam. - Generate a Poisson distribution r2 of 20 numbers with a mean of lam. - Generate a Poisson distribution r3 of 100 numbers with a mean of lam. - Find the cumulative probability of user defined integer x or fewer successes for a Poisson distribution with a mean of lam - Find the theoretical mean of the generated Poisson distributions - Calculate the actual means of r1, r2, and r3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!