Skip to content

Instantly share code, notes, and snippets.

@benwhalley
Created September 19, 2018 13:41
Show Gist options
  • Save benwhalley/058cd2588239eb5acb5b1b0247ad281c to your computer and use it in GitHub Desktop.
Save benwhalley/058cd2588239eb5acb5b1b0247ad281c to your computer and use it in GitHub Desktop.
library(brms)
library(tidyverse)
m1 <- rstanarm::stan_glm(mpg~wt, data=mtcars)
prior_summary(m1)
# see what priors brms will let you set
get_prior(mpg~wt, data=mtcars)
# then then mimic beta priors from rstanarm (inc rstanarm autoscaling)
m2 <- brm(mpg~wt, data=mtcars, sample_prior="only",
prior = c(prior_string("normal(0,15.4)", class="b"),
prior = prior_string("normal(0,60.27)", class="Intercept" )))
samps <- tidybayes::add_fitted_samples(tibble(wt=1:2), m2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment