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

Generate some “fake” residuals under the following scenarios and plot the Q-Q plot and histogram for each. Describe what you see.

Copy the code below to create a design matrix, X and an outcome, y.

set.seed(1)
X <- matrix(c(rep(1, 100),
            rnorm(100)), ncol = 2)
y <- 2 + 3 * X[, 2] + 2 * X[, 2]^2 + 0.5 * X[, 2]^3 + rnorm(100)