From 14754728a5355888a62001c2fadadf170698b8d1 Mon Sep 17 00:00:00 2001 From: Jure Demsar Date: Mon, 7 Dec 2020 13:29:53 +0100 Subject: [PATCH] Version update and further vignette optimization. --- DESCRIPTION | 9 +++++---- vignettes/adaptation_level.Rmd | 2 +- vignettes/flanker.Rmd | 10 +++++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index db8684b..59773dc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,8 +14,8 @@ Encoding: UTF-8 LazyData: true ByteCompile: true Depends: - methods (>= 4.0.3), - R (>= 4.0.3), + methods (>= 4.0.0), + R (>= 4.0.0), Rcpp (>= 1.0.5) Imports: circular (>= 0.4.93), @@ -28,8 +28,9 @@ Imports: rstan (>= 2.21.2), rstantools (>= 2.1.1), mcmcse (>= 1.4.1), - stats (>= 4.0.3), - utils (>= 4.0.3) + scales (>= 1.1.1), + stats (>= 4.0.0), + utils (>= 4.0.0) Suggests: testthat (>= 3.0.0), rmarkdown (>= 2.5.0), diff --git a/vignettes/adaptation_level.Rmd b/vignettes/adaptation_level.Rmd index 741f1ed..911d924 100644 --- a/vignettes/adaptation_level.Rmd +++ b/vignettes/adaptation_level.Rmd @@ -50,7 +50,7 @@ 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 +# prior beta_prior <- b_prior(family="normal", pars=c(0, 1)) # attach priors to relevant parameters diff --git a/vignettes/flanker.Rmd b/vignettes/flanker.Rmd index 5a18998..61a0362 100644 --- a/vignettes/flanker.Rmd +++ b/vignettes/flanker.Rmd @@ -56,14 +56,22 @@ control_rt$subject <- control_rt$subject - 21 Now we are ready to fit the Bayesian reaction time model for both groups. The model function requires two parameters -- a vector of reaction times $t$ and the vector of subject indexes $s$. 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'} +# prior +uniform_prior <- b_prior(family="uniform", pars=c(0, 3)) + +# attach priors to relevant parameters +priors <- list(c("mu_m", uniform_prior)) + # fit rt_control_fit <- b_reaction_time(t=control_rt$rt, s=control_rt$subject, + priors=priors, chains=1, iter=200, warmup=100) rt_test_fit <- b_reaction_time(t=test_rt$rt, s=test_rt$subject, - chains=1, iter=200, warmup=100) + priors=priors, + chains=1, iter=200, warmup=100) ``` Before we interpret the results, we check MCMC diagnostics and model fit.