I might misunderstand you but,
run with brms
(notice I only sample from the priors using sample_prior="only"
)
library(rethinking)
data(chimpanzees)
d <- chimpanzees
detach(package:rethinking, unload = T)
library(brms)
rm(chimpanzees)
m <-
brm(data = d, family = binomial,
pulled_left | trials(1) ~ 1 + prosoc_left,
prior = c(prior(normal(0, 10), class = Intercept),
prior(normal(0, 10), class = b)),
sample_prior = "only")
pl <- posterior_linpred(m)
pe <- posterior_epred(m)
pp <- posterior_predict(m)
Each variable now contains 504 rows and 4000 cols. So the model looks like this:
\mathrm{pulled\_left}_i \sim \mathrm{Binomial}(1,p_i)\\ p_i = \mathrm{inv\_logit}(q_i)\\ q_i = \alpha + \beta_p \cdot \mathrm{prosoc\_left}_i \\ \alpha \sim \mathrm{Normal}(0, 10)\\ \beta_p \sim \mathrm{Normal}(0, 10)
then,
pl
has posterior draws of qpe
has draws of p, i.e., applying the link function, in this caseinv_logit()
pp
has draws from \mathrm{Binomial}(1,p), i.e., the data is on the outcome scale (0/1). (Binomial has no dispersion).
> table(pp)
pp
0 1
1006469 1009531
See here for the example I use translated by @Solomon from McElreath’s book:
and here where @jonah explains it very nicely: