# Design research using brms

**URL:** <https://discourse.mc-stan.org/t/design-research-using-brms/6193>\
**Category:** brms\
**Created:** [October 25, 2018, 2:58pm UTC](https://discourse.mc-stan.org/t/design-research-using-brms/6193 "2018-10-25T14:58:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adwic](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/adwic/32/17233_2.png) [@adwic](https://discourse.mc-stan.org/u/adwic)\
**Post date:** [October 25, 2018, 2:58pm UTC](https://discourse.mc-stan.org/t/design-research-using-brms/6193/1 "2018-10-25T14:58:59Z")

</div>

Hi all,

I’m currently learning how to design a study in Bayesian and decided to use brms since the syntax is very similar with lme4. Usually in frequentist way I run full model and null model, then do likelihood ratio test in order to get the significance because the p-value in full model might not be accurate. After that, I run this simulation x times in order to get the power.  
full model:  
`metrics ~ treatment + (1 + subjectId)`  
null model:  
`metrics ~ (1 + subjectId)`  
How do you do this in Bayesian perspective?  
This is something that I’ve done but still not sure if it’s correct or not:  
Using brms this is what I understood, suppose the model is similar with full model above, so what I need to do is run `hypothesis(full_model, "treatment > 0")` and observe if the posterior probability is higher than alpha then repeat x times to get the “power”.

Thanks and apologies for my English.

- Operating System: macOS 10.13.6
- brms Version: 2.4

---

<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:** [October 25, 2018, 8:18pm UTC](https://discourse.mc-stan.org/t/design-research-using-brms/6193/2 "2018-10-25T20:18:24Z")

</div>

There are many ways to see if treatment has an “effect”. The most straight-forward solution is what you already found via `hypothesis`. As a Bayesian, I would object comparing anything to an “alpha” and then call it “significant” though. Instead you may just report the posterior probability (`Post.Prob`) that the treatment effect is greater zero.

---

<div class="post-metadata">

**Author:** ![adwic](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/adwic/32/17233_2.png) [@adwic](https://discourse.mc-stan.org/u/adwic)\
**Post date:** [October 29, 2018, 2:43pm UTC](https://discourse.mc-stan.org/t/design-research-using-brms/6193/3 "2018-10-29T14:43:49Z")

</div>

Thanks for your response. Right, I should’ve care more about the posterior instead of rejecting or not.  
And after scrolling through the forum I’ve found a neat way to get E[Y|treatment] by using emmeans + tidybayes, this will really help if I use more covariates or more complex model.

---

<div class="post-metadata">

**Author:** ![adwic](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/adwic/32/17233_2.png) [@adwic](https://discourse.mc-stan.org/u/adwic)\
**Post date:** [October 29, 2018, 2:47pm UTC](https://discourse.mc-stan.org/t/design-research-using-brms/6193/4 "2018-10-29T14:47:52Z")

</div>

Thanks for your response. Right, I should’ve care more about the posterior instead of just rejecting or not.  
And after scrolling through the forum I’ve found a neat way to get the E[Y|treatment] by using emmeans + tidybayes, this will really help if I had more than 1 variables.
