关键词 > STAT2203/7203
STAT2203/7203 (S2-2023): Assignment 03
发布时间:2023-10-25
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
STAT2203/7203 (S2-2023): Assignment 03
Due: 27-October-2023 @16:59
1. [5 marks each] We have seen how to simulate from a distribution using the inverse-transform method; see §5.8 of the course notes as well as slide 8/14 of Lecture4-3. Another method to simulate random variables from a given distribution is using rejection sampling. This question concerns a particular application of rejection sampling. Benford’s law is a distribution on the integers {1, 2, . . . , 9} with probability mass function
fD (d) = log10 We would like to be able to simulate the random variable D from this distribution. Suppose X has probability mass function |
||
fX (x) = |
1 9 , |
x ∈ {1, 2, . . . , 9} |
Conditional on X = x, the random variable Y has a Bernoulli(fD (x)/ log10 (2)) distribu- tion. (a) Verify that fD (x)/ log10 (2) ≤ 1 for all x ∈ {1, 2, . . . , 9}. (b) What is the joint probability mass function of (X, Y)? (c) Determine r(Y = 1). (d) Determine the conditional probability mass function of X given Y = 1. (e) This suggests we can simulate a random variable with probability mass function fD using the following algorithm Y = 0 While (Y = 0) { Simulate X from a uniform distribution on {1,2,...,9} Simulate Y from a Bernoulli distribution with success probability f(X)/log10(2) } Return X |
In each loop a new pair of random variables (X, Y) is simulated, independent of all previously simulated random variables. Implement this algorithm in R (or any programming language of your choice). You will need to use a while loop. In R, the general form is while (cond) { expressions } where cond is a length one logical vector. (f) What is the distribution of the number of pairs of random variables (X, Y) that need to be simulated to simulate a single random variable from Benford’s law? |
2. [5 marks each] For The following questions, work out your answers ‘by hand’. You may still use R (or any other programming language) to obtain probabilities and quantiles from the appro- priate distributions and calculate your final answers. A study investigated if psychotherapy combined with limited administration of Methylene- dioxymethamphetamine (MDMA) can reduce symptoms of post-traumatic stress disor- der. Severity of symptoms was measured via the CAPS-IV score with higher scores indicating more severe symptoms. Forty-eight patients recruited to the study with twenty-four patients being randomly allocated each of the two dosage levels (Low – 40 mg, High – 125 mg). The primary outcome was the reduction in CAPS-IV score one month after the end of treatment. The forty-eight patients at the commencement of the study had an average CAPS-IV score of 81.35 with a sample standard deviation of 17.54. At the end of treatment, the High dose group experienced an average drop in CAPS-IV score of 24.2 with a sample standard deviation of 23.1. The Low dose group experienced an average drop in CAPS- IV score of 12.7 with a sample standard deviation of 19.4. (a) Determine a 95% confidence |