Dear users,
I’m using brms to fit some data with an interaction effect. measure_z is a standardized continuous variable, task is a factor with two levels (ON and OFF) and roi is a factor with 10+ levels (A, B, C, …).
fit_rois = brm(
data = data_long,
formula = measure_z ~ task * roi + (1|subjectID),
family = student(),
prior = priors,
chains = 4,
iter = 20000,
warmup = 5000,
refresh = 5000,
sample_prior=TRUE,
save_pars = save_pars(all = TRUE),
backend='cmdstan'
)
summary(fit_rois) contains:
Regression Coefficients:
Estimate Est.Error l-95% CI
Intercept -0.05 0.10 -0.25
taskON -0.05 0.06 -0.18
roiB -0.02 0.07 -0.16
roiC -0.00 0.07 -0.14…
taskON:roiC 0.06 0.10 -0.12
taskON:roiD 0.07 0.10 -0.13
I would like to use brms::hypothesis() to test whether the effect of task is equal to zero at each level of roi.
For the reference level of roi, I believe I need to use hypothesis(fit_rois, “taskON = 0”). However, for other levels of roi, I’m feeling confounded by the syntax. I think this is the correct approach:
this_roi = ‘F’
hypothesis(fit_rois, paste0(“taskON + taskON:roi”, this_roi, " = 0"))
…which works out to hypothesis(fit_rois, “taskON + taskON:roiF = 0”
In particular, I’m very unsure whether adding the task effect at the reference level (“taskON + … ) is appropriate. I’d be very grateful for any advice.
Also, even if what I’m doing technically works, I’d love to see a cleaner approach :)
Edit: added tags