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. When you’ve finished, upload the .html file to Canvas

Input the design matrix, \(\mathbf{X}\) from the following data in R

y age
2 “<20”
3 “20-50”
5 “>50”
10 “<20”
1 “20-50”
3 “>50”

Estimate the \(\beta\) coefficients for predicting y from age.

We are interested in predicting a chicken’s weight based on their diet using the chickwts dataset

Show that the variance of \(\mathbf{x}_0^T\hat\beta\) is

\[\textrm{var}(\mathbf{x}_0^T\hat\beta) = \mathbf{x}_0^T(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{x}_0\sigma^2\]

\[(1 + \mathbf{x}_0^T(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{x}_0)\sigma^2\]