Brms: trying to fit a mediation model using bms

Hello Stan community,

I am trying to fit a mediation model using generalised linear mixed models in brms. I used the R package mediation before but I would like to use bayesian methods for all my analysis and thus I am trying to fit my models with brms:

corloc → binary outcome variable (0|1) declared as numeric
sayyes → binary mediator(0|1) declared as numeric
stimabs → categorical predictor variable (7 levels) declared as factor
m1 ← bf(sayyes~ 1 + stimabs+ (1|subject), family = binomial)
m2 ← bf(corloc ~ 1 + stimabs*sayyes+ (1|subject), family = binomial)
mediation.model<- brm(m1 + m2 + set_rescor(FALSE), data = sensorydec, cores = 4)

I get the following output/error:

Using the maximum response value as the number of trials.
Only 2 levels detected so that family ‘bernoulli’ might be a more efficient choice.
Using the maximum response value as the number of trials.
Only 2 levels detected so that family ‘bernoulli’ might be a more efficient choice.
Compiling Stan program…
Start sampling

Warnings:
1: Using ‘binomial’ families without specifying ‘trials’ on the left-hand side of the model formula is deprecated.
2: Using ‘binomial’ families without specifying ‘trials’ on the left-hand side of the model formula is deprecated.
3: In file.remove(c(unprocessed, processed)) :
can’t delete ‘C:\Users\carina\AppData\Local\Temp\RtmpEFbaxi\file3e941c822587.stan’. reason ‘No such file or directory’

Anyone ever encountered that error? I used brms before and never had any issues. Also the model fitting seems to work, I only get that error after sampling is done.

Thank you for any help,

Carina

Since it’s binary, maybe try “family = bernoulli” instead of “family = binomial”