Labs - Week 2

These sets of labs will introduce you to linear models. Both simple and multiple. This will also be your first introduction to the parsnip package which we will use to specify models.

Exercise 1 - Simple linear regression

  1. Load the data biomass and plot HHV as a function of carbon.
library(tidymodels)
data("biomass")
  1. Fit a simple linear regression model to the data. With HHV as the response and carbon as the predictor. Is it a good fit?

  2. Use the model to predict what the HHV of samples with carbon = 10, 20, ..., 80.

  3. Plot the fitted line of the linear model.

  4. Produce diagnostics plots. You can use plot() on the $fit object to produce some diagnostics.

Exercise 2 - Multiple linear regression

  1. Fit a linear regression model to the data. With HHV as the response and carbon and hydrogen as the predictor. How is the fit compared to the simple linear model?

  2. Fit a linear regression model to the data. With HHV as the response and all the molecules as the predictor. How is the fit compared to the previous models?