Please make sure your final output file is a pdf document. You can submit handwritten solutions for non-programming exercises or type them using R Markdown, LaTeX or any other word processor. All programming exercises MUST be done in R, typed up clearly and with all code attached. Submissions should be made on gradescope: go to Assignments → Homework 7.
Continuation of the swimming data from class. Recall the problem from class on swimming times. Download the data here: http://www2.stat.duke.edu/~pdh10/FCBS/Exercises/swim.dat. Alternatively, you can create the data by manually typing in the data from class slides (here: https://sta-602l-s20.github.io/Course-Website/slides/lec-slides/17-linear-regression.html#70.) into R.
The file contains data on the amount of time in seconds it takes each of 4 high school swimmers to swim 50 yards. There are 6 times for each student, taken every two weeks. That is, each swimmer has six measurements at W=2,4,6,8,10,12 weeks. Each row corresponds to a swimmer and a higher column index indicates a later date. I did not write it explicitly on the slides but the model for each swimmer is Ti=β0+β1(Wi−ˉW)+ϵi, where Ti represents the swimming times and ϵi∼N(0,σ2).Hoff 9.2.
You must write your own sampler for part (a). For part (b), you don’t need to write your own Gibbs sampler. Just follow our approach from class and use the packages. Be sure to compare your results to the results from part (a). You can find the data file azdiabetes.dat
mentioned in the question here: http://www2.stat.duke.edu/~pdh10/FCBS/Exercises/.
20 points.