Application Exercise

  1. Open Rstudio Server Pro
  2. Create a new project
  3. Click File > New File > R Markdown
  4. Delete everything except for
---
title: "Untitled"
output: html_document
---
  1. Give your work a sensible title

  2. After adding your derivation to the file (remember you can incorporate \(\LaTeX\) by wrapping in $$), knit it.

  3. When you’ve finished, upload the .html file to Canvas

  4. Show that \(\mathbf{e}^T\mathbf{e}=\mathbf{y}^T(\mathbf{I-H})\mathbf{y}\).

  5. Calculate \(E[\mathbf{e}^T\mathbf{e}]=E[\mathbf{y}^T(\mathbf{I-H})\mathbf{y}]\).

  6. Find the F-statistic for the model fit in Lab 02:

\[Salary = \beta_0 + \beta_1ATBat+\beta_2Hits +\epsilon\]

Use the code below to get started.

library(ISLR) 
hitters_cc <- Hitters[complete.cases(Hitters), ]