Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save MJacobs1985/4320d7bb6542ec312aebb36fdc0aa418 to your computer and use it in GitHub Desktop.
posterior_interval(model2, prob = 0.80)
d %>%
add_fitted_draws(model2, n = 20) %>%
ggplot(aes(x = ADF, y = ADG)) +
geom_line(aes(y = .value, group = paste(Studycode, .draw))) +
facet_wrap(~ .draw) +theme_bw()
d %>%
add_predicted_draws(model2, n = 100) %>%
ggplot(aes(x = ADF)) +
geom_density(aes(x = .prediction, group = .draw)) +
xlim(-50,200) +theme_bw()
predict_study <- posterior_predict(
model2,
newdata = data.frame(Studycode = c("V0011273"),
ADF = c(83),
Included2017=c("Yes")))
mcmc_areas(predict_study, prob = 0.8)+
ggplot2::scale_y_discrete(labels = c("V0011273"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment