Last active
March 13, 2019 18:48
-
-
Save rudeboybert/1dcbc9fc49caf2ed9da44af826fd8953 to your computer and use it in GitHub Desktop.
Demo of moderndive package functions for tidyverse & novice friendly linear regression
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
library(tidyverse) | |
library(moderndive) | |
# Convert to tibble: | |
mtcars <- mtcars %>% | |
rownames_to_column() | |
# Fit lm | |
mpg_model <- lm(mpg ~ hp, data = mtcars) | |
# Two options for regression table: | |
summary(mpg_model) | |
get_regression_table(mpg_model) | |
# Get observed & fitted values + residuals | |
library(broom) | |
augment(mpg_model) | |
get_regression_points(mpg_model, ID = "rowname") | |
# Scalar summaries | |
get_regression_summaries(mpg_model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment