MATH4007/G14CST COMPUTATIONAL STATISTICS Assessed Coursework 2 — 2021/2022 Your work should be submitted electronically via the module’s Moodle page by 15:00 Wednes- day 4th May 2022. Since this work is assessed, your submission must be entirely your own work (see the University’s policy on Academic Misconduct). Submissions up to five working days late will be subject to a penalty of 5% of the maximum mark per working day. Submission requirements The submission should be uploaded electronically via the submission box on Moodle, and contain: 1. A pdf file containing any computational results (plots/relevant output) and discussion. This can be produced using e.g. R Markdown, or by copying output into a Word document. Please convert any documents to pdf for uploading. 2. A pdf of any theoretical working required. A scan of handwritten work is fine, but you could also typeset using Latex if you prefer. If it’s more convenient, you can combine this and the above part into one, e.g. if you wish to put everything in one Latex document, but this is not required. 3. An R script file, i.e. with a .r extension containing your R code. This should be clearly formatted, and include brief comments so that a reader can understand what it is doing. The code should also be ready to run without any further modification by the user, and should reproduce your results (approximately, for simulation-based results). Please make sure that all required working, results, details of implementation and discussion are contained in components 1 and 2 of the above list and not in the script file. The work will be assessed based on the working, output and discussion in these components, and the script file will only be used for verification of results. The exception is for the R code itself, whereby it is su cient to say “refer to script file” where a question asks you to write R code. A complete submission consists of all the files in your final submission. The submission time of the work will be based on the time at which the submission is complete, i.e. all files are uploaded. Please carefully check after uploading your work that the files you upload are the correct ones. Updates to any part of the submission after the deadline will be considered a new submission and late penalties will be applicable. Questions 1. The whiteside data in the R library MASS contain the measurements of gas consumed and external temperature before and after insulation of a house. We will consider the 26 measurements before insulation, and look at the relationship between gas and temperature. library(MASS) X=whiteside[1:26,c(2,3)] (a) Compute the sample correlation between Gas and Temperature (you may use the R function for this). Generate 10000 (non-parametric) bootstrap samples to compute the standard error of this estimate. (You must code the bootstrap algorithm, do not use boot or similar.) Compute the bias of the estimate using both the bootstrap and the jackknife, and compare. (b) Consider a linear regression model Gasi = a+ bTempi + ✏i, i = 1, · · · , 26. Compute the least squares estimate of b. (You may use the lm command.) Use model-based resampling to produce a 95% confidence interval for b, again coding the bootstrap algorithm yourself. (c) Compute the usual 95% confidence interval for b which results from assuming ✏i iid⇠ N(0, 2), i = 1, · · · , 26. Again, you can use the inbuilt R functions for this. Compare this interval with the bootstrap interval. Plot a density estimate of the sampling distribution of bˆ, based on your bootstrap samples from part (b), and hence comment on the agreement between the two intervals. [15] 2. In a study to monitor glucose levels of patients with diabetes, 10 patients were fitted with continuous glucose monitoring sensors to track glucose levels. If the sensors detect abnormal glucose levels, this triggers an automatic intervention to change the rate of insulin infusion. The following data show the number of days the patients were monitored for (the follow-up time) and the number of instances where abnormal glucose levels were detected so that an automatic infusion intervention was required. Unfortunately, patients 9 and 10 had faulty sensors which failed at some point before the follow-up time, so patients had to manage insulin levels manually. Therefore, all that is known is that the true number of abnormal glucose level instances (counts) at the follow up time is at least as large as the count in the table (indicated by ⇤), which is the number of counts at the point when the sensor failed. Patient 1 2 3 4 5 6 7 8 9 10 Follow-up time (xi) 94 16 63 126 5 1 1 2 10 31 Count (yi) 5 1 5 14 3 1 1 4 15⇤ 11⇤ 2 The following hierarchical model is proposed to model these data. yi|xi, i ⇠ Poisson( ixi), i = 1, . . . , 10