# Group-level and population level monotonic predictor

**URL:** <https://discourse.mc-stan.org/t/group-level-and-population-level-monotonic-predictor/8121>\
**Category:** brms\
**Tags:** cognitive-science\
**Created:** [March 18, 2019, 1:59pm UTC](https://discourse.mc-stan.org/t/group-level-and-population-level-monotonic-predictor/8121 "2019-03-18T13:59:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fusaroli](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/fusaroli/32/477_2.png) [@fusaroli](https://discourse.mc-stan.org/u/fusaroli)\
**Post date:** [March 18, 2019, 1:59pm UTC](https://discourse.mc-stan.org/t/group-level-and-population-level-monotonic-predictor/8121/1 "2019-03-18T13:59:54Z")

</div>

I am trying to estimate a psychometric function by condition, where some conditions are within and some between participants.

Y is a binomial outcome  
X1 is a binomial within participant predictor  
X2 is a binomial between participants predictor  
X3 is an ordinal within participant predictor

My model formula is

Y ~ 0 + X1 : X2 + X1:X2:mo(X3) + (0 + X1 + X1:mo(X3) | SubjectID)

Brms gives me a very understandable:

> Error: Special group-level terms require corresponding population-level terms

However, this was not an issue when X3 was modeled as a continuous variable, and I am not sure how to overcome the issue, given that X2 does not belong to the varying effects.

Is the only solution to change the formula to

Y ~ 1 + X1 \* X2 \* mo(X3) + (1 + X1 \* mo(X3) | SubjectID)

which is more inconvenient for my purpose?

---

<div class="post-metadata">

**Author:** ![matti](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/matti/32/13631_2.png) [@matti](https://discourse.mc-stan.org/u/matti)\
**Post date:** [March 18, 2019, 2:42pm UTC](https://discourse.mc-stan.org/t/group-level-and-population-level-monotonic-predictor/8121/2 "2019-03-18T14:42:20Z")

</div>

Why can’t you include all the varying terms in the population terms with

```
Y ~ 0 + X1 + X1:X2 + X1:X2:mo(X3) + X1:mo(X3) + (0 + X1 + X1:mo(X3) | SubjectID)

```

Then you’d have all the varying effects in the population-level terms as well. It might also make sense to include X3 (or `mo(X3)`) along with its interactions, but that depends on the data and questions.

---

<div class="post-metadata">

**Author:** ![fusaroli](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/fusaroli/32/477_2.png) [@fusaroli](https://discourse.mc-stan.org/u/fusaroli)\
**Post date:** [March 18, 2019, 2:45pm UTC](https://discourse.mc-stan.org/t/group-level-and-population-level-monotonic-predictor/8121/3 "2019-03-18T14:45:39Z")

</div>

Thanks. That runs. It’d be very convenient for me to have separate intercepts and slopes per each condition (the 4 combinations of x1,x2 values), which motivated the question. But I can always calculate them post-hoc.

---

<div class="post-metadata">

**Author:** ![fusaroli](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/fusaroli/32/477_2.png) [@fusaroli](https://discourse.mc-stan.org/u/fusaroli)\
**Post date:** [March 25, 2019, 9:06pm UTC](https://discourse.mc-stan.org/t/group-level-and-population-level-monotonic-predictor/8121/4 "2019-03-25T21:06:54Z")

</div>

Just to make sure, when having:

> X1:X2:mo(X3) + X1:mo(X3)

in the model I get two values for X1:mo(X3) and 2 values for X1:X2:mo(X3).  
Would the two values for X1:mo(X3) correspond to the mean between the two X2 conditions or the parameter estimate for when X2 is 0 (or the baseline value for X2)?
