Extracting posterior summary separately for regressors and participants

#1

Dear all,

sorry this is a very basic question, but I’m also not very familiar with R, so getting a bit stuck with how to extract my posterior summary values of the format oner per person.
if my model is of the form:
fit <- brm(formula= ForageChoice ~ 1+Offer+Cost + (1+Offer+Cost|ID))
How do I get the posterior summary ordered in e.g. a data frame where each row is an ID and the columns are Intercept, Offer, Cost?

For comparison, I have also made a stan model, where e.g.
offer_subj ~ normal(offer_group, offer_sd)
and then I have gotten the outputs that I want using
t=extract(fit,pars=offer_subj)
myParameters=as.data.frame(lapply(t,colMeans)

Many thanks
Jacquie

0 Likes

#2

coef(fit)$ID

0 Likes

#3

thank you!!

0 Likes