Added appendix with R code
Added solution to question 1, part 3
replaced all LaTeX \hat{} with \widehat{} for nicer looking equations