Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started