Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STAT 415 Final Exam

1.  (10pts) Hypothesis Testing.  Assume a state is trying to manage its deer population.  They try to keep the deer herd at 1000 deer.  If the deer herd size is above 1000, they want to increase hunting permits, and if the deer herd size is below 1000, they want to decrease hunting permits.  This year, they conducted 3 surveys of the deer herd. Each survey tries to count the deer, and each survey has a known probability of counting each deer.  The number counted from survey i is x0 , and it is assumed that each survey is independent, with

xl  Binom(n, .5)

x2 ~ Binom(n, .7)

x3 ~ Binom(n, .9)

This year, the three survey results are: xl = 523, x2 = 762, and x3 = 908.

(a) Write a function that evaluates the negative log-likelihood function for these three data points.

Your function should evaluate

nll(n) = 一 log [f(x0 |n, pl ) * f(x2 |n, p2 ) * f(x3 |n, p3 )]

where pl  = .5, p2  = .7, p3  = .9 and f(x|n, p) is the pdf of x ~ binom(n, p). Report this negative- log-likelihood at n = 1000.

(b)  Since the parameter we want to estimate  (n) is discrete,  “optim” is not useful.   To approxi-

mate the MLE for n, do the following.   Evaluate the negative log-likelihood function at n  = 1000, 1010, 1020, 1030, . . . , 1090, 1100.   Set the MLE for n to be the value of n that gives the highest likelihood (and lowest negative-log-likelihhood). You do NOT need to consider any other values of n - only consider the 11 values given above (between 1000 and 1100, in intervals of 10). Report the MLE of n and the negative log likelihood evaluated at the MLE.

(c)  Conduct a likelihood ratio test of H  : n = 1000 vs Hi  : N  1000. Report the test statistic and the p-value of the test statistic. Give enough details that I can see how the test was constructed and the distribution of the test statistic, and any other important choices you made.

(d)  As a result of your analysis, what action, if any, do you suggest the state take with the number of hunting permits given? Explain the reasoning behind your suggestions to the state.

Your answer to this question should be done on Q1-abc123.r”.  Please change the ”abc123” on the file name to your PSU identifier.


2.  (10pts) Confidence Intervals. Use the following R code to read in a set of data:  “x”:

x=c(9,18,20,16,9,9,22,32,23,31,47,18,37,25,18,19,24,19,11,27,24,12,36,12,29,5,9,27,18,17)

Assume that x0  ~ NB(r, p),  i = 1, 2, . . . , 30 with each x0  being a negative binomial random variable independent of all others.   The parameterization used here is the same as used on Wikipedia, and the same used in dnbinom”, with r being a size” parameter and p being a “probability” parameter. Using this data and numerical optimization methods in R, do the following:

● find the MLE and construct a 95% confidence interval for p

● find the MLE and construct a 95% confidence interval for the odds: u = p/(1 一 p).

You do NOT need to report MLEs or confidence intervals for r. You may use ANY one of the methods we have learned for constructing confidence intervals.  Your work should include enough detail that I understand clearly how you obtained your answer.

Your answer should be in the Q2-abc123.r” file with all the R code needed to obtain your result. You may also upload a scanned file of any analytic work you did to obtain your answer, if you feel it would be helpful.

 

3.  (10pts) Bayesian Inference. Use the following R code to read in a set of data:  “y”:

y=c(3.217,4.266,3.091,1.826,5.181,5.060,3.155,0.607,3.002,4.487,

6.576,8.366,6.171,3.801,2.169,6.540,5.738,7.725,2.510,2.930,

8.993,0.937,5.133,2.124,11.532,0.829,6.433,4.838,7.428,5.388)

Assume that y0  ~ χ2 (v),  i = 1, 2, . . . , 30 (a Chi-square distribution with v degrees of freedom - in R this is “dchisq”) with each y0  independent of all others. The parameter v is the degrees of freedom of the χ2  distribution, and v can take on non-negative integer values v ∈ {0, 1, 2, 3, . . .}.

Your goal is posterior inference on v under a Bayesian framework.  Assume your prior for v is v ~ Pois(6). Use a proposal distribution for v that is Poisson, with the mean of the proposal distribution being the current value of v. Run your MCMC long enough that you have an effective sample size of at least 500.

Report the posterior mean of v, and a 95% credible interval on v. Your answer should clearly list the main steps you used to obtain your result, and give enough detail that I understand any choices you made.

Turn in your answer on Q3-abc123.r”, but change the abc123” to your PSU identifier.