Skip to content

Commit

Permalink
Added a prior on beta coefficients.
Browse files Browse the repository at this point in the history
  • Loading branch information
demsarjure committed Dec 7, 2020
1 parent a7b897f commit 013f682
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vignettes/adaptation_level.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down

0 comments on commit 013f682

Please sign in to comment.