Accessing brmsfit object variables for hypothesis testing

Hello, I am fitting a model with response v1, to one categorical variable (v2) and one continuous (v3), sample code below. My problem is that I do not know how to access the effect sizes at different levels of v2 , so that I can pass them onto hypothesis() for significance testing.


control = list(adapt_delta=0.95, max_treedepth=12)
niter = 2000
priors=c() #priors = c(prior(normal(0,1), class=Intercept, lb=0), prior(normal(0,1), class=sd, lb=0) )

data$v2 = factor(data$v2)

m1  = brm(v1 ~ (1|v2) + v3, data=data, prior=priors, iter=niter, save_pars=save_pars(all=TRUE), control=control, file="M1" )
f1 = fixef(m1)
r1 = ranef(m1)
c1 = coef(m1)

m1 =

# compare levels within factor v2 (pseudocode)
#h1 = hypothesis(m1, "v2_level1 - v2_level2 = 0")

Please point me to the proper ways of accessing the m1 object’s variables compatible with the expected hypothesis() syntax.

Thank you all.

Try running hypothesis() without this line:

m1 =

I believe you want to feed your brm() model into hypothesis() as is, without trying to save the model object as a data frame.

1 Like