Total Marks: 50
Instruction: Please type your answers in a Word document and clearly label all your answers and graphs and tables for their corresponding questions. Use Word equation editor (or any equation editor of your choosing) to write all equations.
Question One (8 marks)
Suppose that 85% of adults with allergies report symptomatic relief with a specific medication. If the medication is given to 20 new patients with allergies find the probability correct to four decimal places that
- it is effective in exactly eight patients? (2 marks)
- it is effective in at least three patients? (2 marks)
- it is effective in between 4 to 7 patients both inclusive? (2 marks)
- it is effective in exactly eight patients, given that it is effective in at least 5 patients? (2 marks)
Question Two (10 marks)
A recent study has shown that 70% of people who don’t wear glasses get regular headaches, while only 25% of people who wear glasses are headache sufferers. If 40% of people wear glasses, find the probability that a randomly selected person:
- Draw a tree diagram to illustrate this scenario (2 marks)
- wears glasses and gets headaches (2 marks)
- does not wear glasses and suffers from headaches (2 marks)
- suffers from headaches (2 marks)
- wears glasses, given that the person does not suffer from headaches. (2 marks)
Question Three (19 marks)
We are interested in the average number of hours () a college student sleeps on any given day. Suppose that a professor has formed the following prior belief that follows a normal distribution with a mean and variance .
- Write down the prior distribution as specified by the professor. (1 mark)
- Use the “curve” function (as demonstrated in the lectures) to graph this prior density. Please include both your R-codes and the graph in your answer. (1 mark)
- Use the “qnorm” function to provide the quartiles of the prior distribution. Please include both your R-codes and the values. (1 mark)
- Provide your own average hours of sleep a day, and use the “pnorm” function, calculate the probability of sleeping more than your average hours of sleep under this professor’s prior. Please include both your R-codes and the values. (1 mark)
- Suppose that the professor collected data from of his students, and obtained the following series:
y=c(6.1,5.9,6.2,5.7,5.1,6.7,5.8,6.4,6.8,4.5,6.3,6.1,6.6,6.1,5.6,6.3,6.6,5.4,6.1,6.2,5.2,6.2,
6.3,6.7,6.5,5.8,5.4,4.8,6.8,6.3,6.5,6.2,6,5.8,5.2,6.3,6,6.1,4.8,6)
Write down the Normal likelihood function for this problem, treating BOTH the mean and the variance as UNKNOWN, using and respectively. (2 mark)
Write down the log likelihood function for this problem. (2 mark)
- Estimate BOTH and using Maximum Likelihood (using the sample series provided in part (e)). Please include both your R-codes and the estimation outputs. (2 marks)
- What is the 95% confidence interval on based on your Maximum Likelihood estimates? Does it contain the professor’s prior mean ? (Hint: work out the standard deviation of the estimated first). (2 marks)
- Suppose we have strong research evidence suggesting that the natural variation in hours of sleep in normal human beings is a constant and is fixed at . For a Gaussian density with an unknown mean but a known fixed variance, the likelihood function can be written as:
Briefly explain the difference between this likelihood function and the one you wrote for part (e). (1 mark)
- Use the “curve” function (as demonstrated in the lectures) to graph this likelihood. Please include both your R-codes and the graph in your answer. (Hint: use the sample mean and sampling variance of the sample mean () as mean and variance inputs to the function respectively.) (2 marks)
- It can be shown that the posterior density for is also Normal distribution with posterior mean and variance solved analytically as
Using what you know from the specification of the problem, work out the values of posterior variance and posterior mean . (2 marks)
- Using THREE applications of the “curve” function and using different colours, plot the Prior, the likelihood, and the Posterior together. (2 marks)
Question Four (6 marks)
On Philip Island, sea birds are observed nesting at three sites: A, B and C. The transition diagram below can be used to predict the movement of these sea birds between these sites from year to year.
- Construct a transition matrix that can be used to represent the transition diagram above. Use columns to define the starting points and convert the percentages to decimals. (2 marks)
Suppose this year, 600 sea birds were observed nesting at site A, 250 sea birds were observed at site B and 150 sea birds were observed at site C.
- How many sea birds will be observed at site C next year? (2 marks)
- Find the steady-state distribution. (Hint use R to do the matrix multiplication) (2marks)
Question Five (7 marks)
Let be random variables conditionally independent given p,
where , with each Bernoulli(. p).
- Derive likelihood function (2 marks)
- Find the posterior distribution of. (2 marks)
- Show that the posterior mean can be written as a weighted average of the prior mean, and the maximum likelihood estimate of p, . (3 marks)