Blood Pressure

The following data were obtained in a study of the relation between diastolic blood pressure and age for boys 5 to 13 years old. We will manually implement a regression of blood pressure on age.

\(i\): 1 2 3 4 5 6 7
age: 5 8 11 7 13 12 6
pressure: 63 67 74 64 75 69 60
  1. Create the response vector in R, call it y.

  2. Create the design matrix in R, call it X.

  3. Calculate the OLS estimates from a regression of pressure on age using matrix multiplication in R. Call this vector betahat.

  4. Calculate the fitted values from the above defined quantities. Call this vector yhat.

  5. Calculate the residuals from the above defined quantities. Call this vector e.

  6. Calculate the MSE from the above defined quantities. Call this value mse.

  7. Calculate the standard errors of \(\hat{\mathbf{\beta}}\) from the above quantities.

  8. Verify all of your calculations above using lm().