Skip to content

Instantly share code, notes, and snippets.

@conormm
Created September 1, 2017 20:27
Show Gist options
  • Save conormm/eac16287e42e0fcda4827f578f4cbe6c to your computer and use it in GitHub Desktop.
Save conormm/eac16287e42e0fcda4827f578f4cbe6c to your computer and use it in GitHub Desktop.
fit <- num_df %>%
map(scale) %>%
as.data.frame() %>%
bootstrap(10) %>%
do(tidy(lm(imdb_score ~., data = .), conf.int = TRUE)) %>%
mutate(sig_0005 = p.value < 0.005)
fit %>%
filter(term != "(Intercept)") %>%
group_by(term) %>%
ggplot(aes(reorder(term, estimate), estimate, colour = sig_0005)) +
geom_point(alpha = 0.4) +
coord_flip() +
theme_minimal() +
geom_hline(aes(yintercept = 0), linetype = "dashed", colour = "blue") +
labs(title = "Linear regression estimates",
subtitle = "Dependent variable: IMDB score",
x = "Independent variable",
y = "estimate")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment