Probably a basic question, but say I have a model Y ~ X1*X2 and both X1 and X2 are continuous. How would I do a directional hypothesis test for the effect of X1, conditioned on the predictor X2 being some arbitrary value, e.g., X2 = 2?

Just plug in `2`

for `X2`

(or whatever value) when computing your predictions.

Using the `predict`

function? If so, how do I then test the hypothesis (e.g., that the effect of X1 > 0)?

If `X2 = 2`

:

```
hypothesis(<model>, "X1 + X1:X2 * 2 > 0")
```

Of course, thatâ€™s beautiful and simple! Thank you.

What if he were to just test for the interaction effect? would the following server the purpose paul.buerkner?

hypothesis( , â€śX1:X2 > 0â€ť)

Yes, this would be sufficient.

So say both predictors are categorical and both have two levels, sum coded to +1 and -1. Could I find the effect of X1 at each level of X2 like this:

hypothesis(, â€śX1 + X1:X2 * 1 > 0â€ť)

hypothesis(, â€śX1 + X1:X2 * -1 > 0â€ť)

Thanks

Ben

Yes.

Hi Paul, may I know how to plug in values in models with category specific predictors?

I have

```
Y~X1:X2:X3+cs(X4),family=brmsfamily("acat","logit")
```

Y is a three-level ordinal variable (incorrect, partial, correct), X1 to X4 are binary variables.

I would like to test when X1=1, whether the probability of Y=partial (compared to Y=correct) will be greater for X4=1 (compared to X4=0)

I tried the hypothesis function in brms:

```
hp<-c("hp_X4"=
"plogis(b_Intercept[2]-
(b_X1*1+b_X2+b_X3+b_X1*1:X2+b_X1*1:X3+b_X2:X3+b_X1*1:X2:X3+bcs_X41[2]*1))>
plogis(b_Intercept[2]-
(b_X1*1+b_X2+b_X3+b_X1*1:X2+b_X1*1:X3+b_X2:X3+b_X1*1:X2:X3+bcs_X41[2]*0))")
print(hypothesis(model, hp, class = NULL),digits=3)
```

and found:

```
Error: Some parameters cannot be found in the model:
'X2', 'X3', 'X2:X3'
```

May I know whether the expressions in plogis() are correct and how to plug in X1=1 in this model? Thank you.

you need to set class = â€śbcsâ€ť to target cs() parameters in hypothesis.

@paul.buerkner Thanks for your reply. I tried to change class=NULL to class=â€śbcsâ€ť, it seems that the class=â€śbâ€ť parameters can not be identified

```
Error: Some parameters cannot be found in the model:
'bcs_Intercept[2]', 'bcs_X1'...
```

If I specified the full name of the parameters (e.g., b_X1, bcs_X4) and use class=NULL without plugging in values, the hypothesis function works well.

```
hp1<-c("hp_X4"=
"plogis(b_Intercept[2]-
(b_X1+b_X2+b_X3+b_X1:X2+b_X1:X3+b_X2:X3+b_X1:X2:X3+bcs_X41[2]))>
plogis(b_Intercept[2]-
(b_X1+b_X2+b_X3+b_X1:X2+b_X1:X3+b_X2:X3+b_X1:X2:X3))")
print(hypothesis(model, hp1, class = NULL),digits=3)
```

Is it possible to plug in X1=1? It seems that there is something wrong with the interaction terms (e.g. X1*1:X2) when plugging in values. Thank you.

Set `class = NULL`

and add class prefixes (`b_`

etc.) to the parameter names in the hypothesis.

I have a three-way interaction term X1:X2:X3 in the model. I set class=NULL and plugged in X1=1

```
b_X1*1+b_X2+b_X3+b_X1*1:X2+b_X1*1:X3+b_X2:X3+b_X1*1:X2:X3
```

but this didnâ€™t work

```
Error: Some parameters cannot be found in the model:
'X2', 'X3', 'X2:X3'
```

It seems that only the last variable in the interaction term can be plugged in a value in this way (e.g. X1:X2:X3*1 works well). Is it possible to plug in X1=1? Thank you.