Skip to content

Instantly share code, notes, and snippets.

@keithmcnulty
Created September 1, 2020 10:47
Show Gist options
  • Save keithmcnulty/ff9a13dbb4aed13f779b556e056ab0c6 to your computer and use it in GitHub Desktop.
Save keithmcnulty/ff9a13dbb4aed13f779b556e056ab0c6 to your computer and use it in GitHub Desktop.
library(broom)
penguin_models <- penguins %>%
dplyr::group_by(species) %>%
dplyr::summarise(broom::glance(lm(body_mass_g ~ flipper_length_mm + bill_length_mm + bill_depth_mm))) # summarise model stats
penguin_models
# A tibble: 3 x 13
species r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC deviance df.residual nobs
<fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <int>
1 Adelie 0.508 0.498 325. 50.6 1.55e-22 3 -1086. 2181. 2196. 15512707. 147 151
2 Chinstrap 0.504 0.481 277. 21.7 8.48e-10 3 -477. 964. 975. 4910650. 64 68
3 Gentoo 0.625 0.615 313. 66.0 3.39e-25 3 -879. 1768. 1782. 11641483. 119 123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment