Using Python 2.x, generate random samples from the Poisson distribution with = 4
ID: 3771063 • Letter: U
Question
Using Python 2.x, generate random samples from the Poisson distribution with = 4, using 20, 50, 100, 200, 500, 1000, 2000 data points. For each of the sample, estimate the mean and standard deviation. Then plot the estimated values as functions of the sample size.
2) For each of the sample generated, estimate the 95% confidence interval of the estimated mean. Plot of the upper and lower bound of the confidence intervals as function of the sample size. How often does the true parameter value fall outside of the confidence intervals?
Explanation / Answer
init: Let L exp(), k 0 and p 1. do: k k + 1. Generate uniform random number u in [0,1] and let p p × u. while p > L. return k 1. int c beta = PI/sqrt(4.0*lambda) alpha = beta*lambda k = log(c) - lambda - log(beta) forever { u = random() x = (alpha - log((1.0 - u)/u))/beta n = floor(x + 0.95) if (n < 0) continue v = random() y = alpha - beta*x lhs = y + log(v/(1.0 + exp(y))^2) rhs = k + n*log(lambda) - log(n!) if (lhsRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.