Last active
April 14, 2018 00:31
-
-
Save derekpowell/fd2d67f0b3334caf534abceb65401e0b to your computer and use it in GitHub Desktop.
R: extract ggplot object from brm marginal_effects() plot
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
gg_marginal_effects <- function(model, effects, probs=c(0.25, 0.75)) { | |
me <- brms::marginal_effects(model, effects=effects, probs=probs) | |
plt.me <- plot(me, | |
effects=effects, | |
plot=FALSE, | |
rug=TRUE, | |
theme=ggplot2::theme_get() | |
)[[1]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment