R programming

 

R programming
Please title your file netID.pdf
replacing \netID” with your actual netID. There is to be no collaboration of any kind on
this exam. The only resources you may use are your book, notes, Blackboard (for STAT
6501/6502 only), and built-in help files within the R program (i.e. no Google). You must
include all pertinent R code at the end of each part for full credit. You will be graded on
both accuracy and presentation of your solutions.
60 Pts 1. In \gacha” phone games, there are usually numerous characters that players can obtain, and
most of them are only obtainable via the \gacha” mechanism. The \gacha” mechanism would
allow players to draw using a specific amount of in-game currency, which would give the player
a randomized character. These characters are rated on a star system (3 being most common
whereas 5 are the rarest). Because some of these characters would be given less chance to
appear (rarest having smallest probability, but most desirable), typically players would need to
spin the \gacha” many times before they can get the most desired outcome. We are interested
in testing the company’s claim that 5-star characters have a drop rate of 3% by investigating
how many draws it takes to observe the first 5-star character.
We will now perform the experiment 30 times, where the outcome of each experiment is the
number of draws needed to get the first 5-star character. Since we doubt the company’s claim,
we are interested in showing the actual probability of drawing a 5-star character is less than
the claimed 0.03.
(a) Find the unrestricted MLE of p, the probability of a 5-star character (be sure to check the
second derivative).
(b) Find the generalized likelihood ratio test statistic. Without using the large sample approximation, define an appropriate test by

READ ALSO :   Academic help online

giving the test statistic and rejection region as
a function of α. Be sure to state your hypotheses.
(c) Use the following commands to generate the data
set.seed(1234); x = rgeom(30,.02)+rep(1,30)
Perform the test above at the 0.05 level of significance. Does your answer surprise you?
Explain.
(d) Calculate and plot the power curve (not a simulation) for p < 0:03 and determine the
values of p needed to get a power of at least 0.8.
Page 1 of 2 Continue on next page . . .Associate Professor J. Kerr Take Home Final Exam STAT 6502 Winter 2018
40 Pts 2. Suppose the experiment from question 1 above was repeated by an independent party. Since
the in-game currency costs real money, the researcher decides to not draw more than 70 times
on a single experiment (this is called right-sensoring), but is willing to do 50 such experiments
(instead of the 30 in problem 1). The researcher here wants to assess if the geometric model is
reasonable for her data. The summarized data is in the table below (here, X is the number of
draws until the first 5-star is observed):
X (0, 12] (12, 24] (24, 36] (36, 70] (70, 1)
counts 9 11 9 12 9
(a) Find the maximum likelihood estimator of p based on these 50 observations under the null
hypothesis that X has a geometric distribution.
(b) Calculate the expected counts.
(c) Perform the likelihood ratio goodness-of-fit test at α = 0:05 to see if the model specified
under the null hypothesis is adequate to describe the behavior of the population that
produced this data.