Lab Assignment 2
Fill in your Name
Fill in the date
Likelihood methods for the Poisson distribution
DO NOT CHANGE the chunk name or the set.seed() values below.
Execute each chunk of code to ensure that your code works properly.
Then HTML knit the entire document.
If you cannot compile all of your code without errors before the end of the class, comment out the
chunks that are not working.
Open the HTML document in a browser.
Save the HTML file as a pdf file.
Submit your pdf assignment.
1. First generate 25 observations from the Poisson(lambda=10) distribution and
save them in a vector.
2. Write a function to compute the Log-likelihood for a vector of values of the
mean lambda given the n observations you generated in question 1. Plot the
log-likelihood for a sequence of values of lambda. Axes must be labelled and the
plot must have a title. Ensure that you choose a sequence of lambda values that
bracket the MLE for lambda.
3. Compute the MLE of lambda using the data from question 1 and the function
you defined in question 2 and the optimize() function.
4. Write a function to compute the log relative likelihood - ln(p), r(lambda) -
ln(p) and graph it for a sequence of lambda values and p=.147.
5. Compute the 14.7% Likelihood Interval as the roots of r(lambda) - ln(.147)
= 0. Show the results.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。