Computing and summarizing contrasts from brmsfit

Are you aware of a function which can be used to compute contrasts based on brmsfit models
similar to lmerTest::contest function e.g.

contest(model, linfct)

I assume I could compute a contrasts just by:

postsample <- posterior_samples(fit1,"^b")
as.matrix(postsample) %*% as.matrix(c(1,1,0,-1))

but than I also will need to write all the functions to create visualizations and summaries.
Could you point me in the right direction?

Please also provide the following information in addition to your question:

  • Operating System: Windows Linux
  • brms Version: ‘2.10.0’

Hi and welcome to the community!

Have you checked this? I usually do it as in the second post below (@bgoodri’s reply).

1 Like

Hi Torker,

Thank you for your suggestions but it does not fit this “use case”
I typically test multiple hypothesis using the same model (models of factorial designs) using linear combinations of the parameter estimates.

What I actually looking for is a recommendation for functions which would help me to interpret and visualize the results of

postsample <- posterior_samples(fit1,"^b")
as.matrix(postsample) %*% cbind(c(1,1,0,-1), c(0,0,-1,0 ), .... many more )

Ideally I would like to be able to use exactly the same functions which can be used to summarize brmsfit models e.g. summary.brmsfit.