Question: Q3 [6 Points] Construct a function to return the mean and variance of the distribution Print out the mean and variance of this distribution assuming
![Q3 [6 Points] Construct a function to return the mean and](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66d95f0537e6b_66866d95f04a38eb.jpg)
Q3 [6 Points] Construct a function to return the mean and variance of the distribution Print out the mean and variance of this distribution assuming p = 0.8 In [e]: def LogDist_iterative (p): #Fill in the operations here return mean, variance In [0]: ##Call the function to return PMF corresponding to x=1, ..., 20 and p=0,8 #print out the PMF array result ##Q4 10 Points] The expected value of a discrete distribution follows: E(x) = ; XiPi For the distribution we work with, we need to sum up infinite terms. If we only sum up xip; from i = 1 up to i = k, where k is a large value, we can get a good approximation although not exact. Construct an array that gives how much error we have for the expected value when we choose k=1, 2, ..., 30. In [O]: #construct the array here print(Error_array) Q3 [6 Points] Construct a function to return the mean and variance of the distribution Print out the mean and variance of this distribution assuming p = 0.8 In [e]: def LogDist_iterative (p): #Fill in the operations here return mean, variance In [0]: ##Call the function to return PMF corresponding to x=1, ..., 20 and p=0,8 #print out the PMF array result ##Q4 10 Points] The expected value of a discrete distribution follows: E(x) = ; XiPi For the distribution we work with, we need to sum up infinite terms. If we only sum up xip; from i = 1 up to i = k, where k is a large value, we can get a good approximation although not exact. Construct an array that gives how much error we have for the expected value when we choose k=1, 2, ..., 30. In [O]: #construct the array here print(Error_array)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
