How to capture the mean, standard errors , 2.5%, 50%, and 97.5% using brms package

library(brms)
fit3 <- brm(formula = y ~ x1 + x2, prior = c(set_prior(“normal(0,1000)”, class =“b”)), chains=3,
iter=500,warmup=100, thin=2, data = mydata, family = bernoulli, seed=123)

I would like to capture the coefficients of the model

Hey Lovemore,
you could take a look at the brms documentation and their examples, starting here: https://cran.r-project.org/web/packages/brms/vignettes/brms_overview.pdf
or the statistical rethinking with brms, ggplot2 and tidyverse project by A. Solomon Kurz together with the second version of the course by McElreath here. The course by McElreath together with the book(there is a draft available as well) is a very good introduction and might be worth your time if you want a deeper understanding.

Depending on what exactly you want there are different ways:
you could use one of summary, coef, fixef, posterior_summary or posterior_sample for example.

And while I don’t know your data, a normal(0,1000) seems like it might be too wide for most cases.

Cheers

1 Like