# Using \*\*hypothesis()\*\* with \*\*s()\*\* from \*\*brms\*\*

**URL:** <https://discourse.mc-stan.org/t/using-hypothesis-with-s-from-brms/19782>\
**Category:** brms\
**Created:** [December 13, 2020, 1:57pm UTC](https://discourse.mc-stan.org/t/using-hypothesis-with-s-from-brms/19782 "2020-12-13T13:57:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![striatum](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@striatum](https://discourse.mc-stan.org/u/striatum)\
**Post date:** [December 13, 2020, 1:57pm UTC](https://discourse.mc-stan.org/t/using-hypothesis-with-s-from-brms/19782/1 "2020-12-13T13:57:15Z")

</div>

Can one specify a hypothesis to test, for example, a difference between:

```
s(Covariate, by=TwoLevelFactor)

```

This gives the two smooth terms, one for each level of the fixed factor. The `hypothesis()` should, then, test if there is a difference (i.e., whether `by=by=TwoLevelFactor` is justified or not.

Thanks!

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [December 16, 2020, 8:17am UTC](https://discourse.mc-stan.org/t/using-hypothesis-with-s-from-brms/19782/2 "2020-12-16T08:17:38Z")

</div>

Sorry for taking time to reply to your post. I have not worked much with splines, and there could be `brms` specific things here so my hope is that @paul.buerkner can reply.

---

<div class="post-metadata">

**Author:** ![paul.buerkner](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/paul.buerkner/32/3303_2.png) [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)\
**Post date:** [December 16, 2020, 8:52am UTC](https://discourse.mc-stan.org/t/using-hypothesis-with-s-from-brms/19782/3 "2020-12-16T08:52:45Z")

</div>

hypothesis() unfortunately does not work with splines because splines are presented by a whole set of themselves uninterpretable parameters. I suggest you created spline predictions via `posterior_smooths` and then do the comparison on a per-draw level before summarizing the difference scores via `posterior_summary`.
