From 013f6821689c4fa51375bf9910de9bd2a04b4dc4 Mon Sep 17 00:00:00 2001 From: Jure Demsar Date: Mon, 7 Dec 2020 11:26:00 +0100 Subject: [PATCH] Added a prior on beta coefficients. --- vignettes/adaptation_level.Rmd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vignettes/adaptation_level.Rmd b/vignettes/adaptation_level.Rmd index fc58518..741f1ed 100644 --- a/vignettes/adaptation_level.Rmd +++ b/vignettes/adaptation_level.Rmd @@ -50,14 +50,23 @@ group2_part2 <- data %>% filter(group == 2 & part == 2) Once the data is prepared we can fit the Bayesian models, the input data comes in the form of three vectors, $x$ stores indexes of the measurements, $y$ subject's responses and $s$ indexes of subjects. Note here that, due to vignette limitations, all fits are built using only one chain, using more chains in parallel is usually more efficient. Also to increase the building speed of vignettes we greatly reduced the amount of iterations, use an appropriate amount of iterations when executing actual analyses! ```{r, message=FALSE, warning=FALSE, results = 'hide'} +# priors +beta_prior <- b_prior(family="normal", pars=c(0, 1)) + +# attach priors to relevant parameters +priors <- list(c("mu_b", beta_prior)) + + fit1 <- b_linear(x=group1_part2$sequence, y=group1_part2$response, s=group1_part2$subject, + priors=priors, iter=200, warmup=100, chains=1) fit2 <- b_linear(x=group2_part2$sequence, y=group2_part2$response, s=group2_part2$subject, + priors=priors, iter=200, warmup=100, chains=1) ```