Skip to content

Instantly share code, notes, and snippets.

@graebnerc
Created June 1, 2022 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graebnerc/d61da231fbc479434476fab221157536 to your computer and use it in GitHub Desktop.
Save graebnerc/d61da231fbc479434476fab221157536 to your computer and use it in GitHub Desktop.
Lecture notes and solutions to the exercises of session 11 and 12 on linear models
here::i_am("R/lm-exercise.R") # Adjust to position of your file
library(dplyr)
library(skimr)
library(moderndive)
library(ggplot2)
beer_data <- DataScienceExercises::beer
dplyr::glimpse(beer_data)
skim(beer_data)
beer_inc_plot <- ggplot(
data = beer_data,
mapping = aes(y = consumption, x = income)
) +
geom_point() +
geom_smooth(method = "lm") +
theme_bw()
beer_inc_plot
beer_lm <- lm(formula = consumption~income, data = beer_data)
moderndive::get_regression_table(beer_lm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment