I would like to check the Bayes Factor (BF) of a main effect (e.g. `zBase`

), comparing the following two model: (1) the model which has that main effect (`count ~ zBase + Trt + zBase:Trt`

) and (2) the model which does not contain the main effect (`count ~ Trt + zBase:Trt`

).

```
library(brms)
## model 1
fit <- brm(
count ~
zBase +
Trt +
zBase:Trt +
(1 | patient),
data = epilepsy,
family = poisson(),
prior = c(
prior(normal(0, 1), class = b, coef = zBase),
prior(normal(0, 1), class = b, coef = Trt1),
prior(normal(0, 1), class = b, coef = zBase:Trt1),
prior(normal(0, 1), class = sd)
)#,
#backend = "cmdstanr"
)
## model 2
fit.no.M.ZBase <- brm(
count ~
#zBase +
Trt +
zBase:Trt +
(1 | patient),
data = epilepsy,
family = poisson(),
prior = c(
#prior(normal(0, 1), class = b, coef = zBase),
prior(normal(0, 1), class = b, coef = Trt1),
prior(normal(0, 1), class = b, coef = zBase:Trt1),
prior(normal(0, 1), class = sd)
)#,
#backend = "cmdstanr"
)
```

Specifying the prior of each parameter, I am able to fit the first model but not the second. Although I overtly set the priors, the programme cannot find the prior specification of the interaction:

```
Error: The following priors do not correspond to any model parameter:
b_zBase:Trt1 ~ normal(0, 1)
Function 'get_prior' might be helpful to you.
```

After I ran `get_prior`

, it turns out that the order of the two main effects (`zBase`

and `Trt`

) in the interaction term of the second model flips from `zBase:Trt1`

to `Trt1:zBase`

, automatically and unexpectedly.

So, * dropping one of the main effects unexpectedly alter the order of these main effects in an interaction term*, as shown below, and interrupts my prior specification. Then, how can I keep the order of main effects in an interaction term, when one of the main effect is dropped?

```
## for model 2, see the interaction term of the formula and returned value
get_prior(
count ~
#zBase +
Trt +
zBase:Trt +
(1 | patient),
data = epilepsy,
family = poisson()
)
> prior class coef group resp dpar nlpar bound source
(flat) b default
(flat) b Trt0:zBase (vectorized)
(flat) b Trt1 (vectorized)
(flat) b Trt1:zBase (vectorized)
student_t(3, 1.4, 2.5) Intercept default
student_t(3, 0, 2.5) sd default
student_t(3, 0, 2.5) sd patient (vectorized)
student_t(3, 0, 2.5) sd Intercept patient (vectorized)
```

Note but, the order of the two main effects in the returned value of `get_prior`

is `zBase:Trt1`

, same as I overtly specified in the formula, when the * all* main effects are specified in the formula.

```
## for model 1
get_prior(
count ~
zBase +
Trt +
zBase:Trt +
(1 | patient),
data = epilepsy,
family = poisson()
)
> prior class coef group resp dpar nlpar bound source
(flat) b default
(flat) b Trt1 (vectorized)
(flat) b zBase (vectorized)
(flat) b zBase:Trt1 (vectorized)
student_t(3, 1.4, 2.5) Intercept default
student_t(3, 0, 2.5) sd default
student_t(3, 0, 2.5) sd patient (vectorized)
student_t(3, 0, 2.5) sd Intercept patient (vectorized)
```

## Operating System

R version 4.0.2 (2020-06-22)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 18363)

## Interface Version

packageVersion(“brms”)

[1] ‘2.14.4’