Created
June 1, 2022 14:11
-
-
Save graebnerc/d61da231fbc479434476fab221157536 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lecture notes and solutions to the exercises of session 11 and 12 on linear models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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