Skip to content

Instantly share code, notes, and snippets.

@MJacobs1985
Created December 10, 2021 20:51
Show Gist options
  • Select an option

  • Save MJacobs1985/a0317fc2f7c98ff5098ab22c0c6b3898 to your computer and use it in GitHub Desktop.

Select an option

Save MJacobs1985/a0317fc2f7c98ff5098ab22c0c6b3898 to your computer and use it in GitHub Desktop.
B0 <- tidy_summary_1$estimate[1]
B1 <- tidy_summary_1$estimate[2]
B2 <- tidy_summary_1$estimate[3]
d %>%
add_fitted_draws(model2, n = 200, re_formula = NA) %>%
ggplot(aes(x = ADF, y = ADG)) +
geom_line(aes(y = .value, group = .draw), alpha = 0.1) +
geom_abline(intercept = B0+B2, slope = B1, color = "blue") +theme_bw()
Studycode_summaries_1 <- model2 %>%
spread_draws(`(Intercept)`, b[,Studycode]) %>%
mutate(Studycode_intercept = `(Intercept)` + b) %>%
dplyr::select(-`(Intercept)`, -b) %>%
median_qi(.width = 0.80) %>%
dplyr::select(Studycode, Studycode_intercept, .lower, .upper)
Studycode_summaries_1 %>%
filter(Studycode %in% c("Studycode:V0011207", "Studycode:V0011270"))
d %>%
filter(Studycode %in% c("V0011207", "V0011270")) %>%
add_fitted_draws(model2, n = 100) %>%
ggplot(aes(x = ADF,
y = ADG)) +
geom_line(
aes(y = .value,
group = paste(Studycode, .draw),
color = Studycode),
alpha = 0.1) +
geom_point(aes(color = Studycode)) + theme_bw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment