-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use 'rtdists' for post-processing of wiener diffusion models #385
Conversation
On a first look everything looks fine. But I will run some real tests at some point next week to make sure we are not overlooking something. However, I have two deadlines next week, Monday and Wednesday. So it might take a few days. |
I will have to release the new brms version in the next few days as soon as loo 2.0 is on CRAN. Do you think you can take a more thorough look today or tomorrow? That would be really nice! |
I took a more in depth look into it in the last days and it seems that my assumption about speed were again wrong (I probably should simply stop making assumption about speed of code). I tested the new code against the model fitted in my blog post (http://singmann.org/wiener-model-analysis-with-brms-part-i/). For this code, your implementation based on One problem with your code is that it does not use the vectorization that is already implemented in I believe remembering that there are certain parameter setting for which the RNG of I want to apologize for having costed you time without any real benefit. Sorry. One more thing, I also looked at the actual outcomes of all versions (i.e., the posterior predictive distributions) and they were all pretty much equivalent. |
Thank Henrik for such a detailed analayis! And no worries, it didn't took me too long and it is good to know, that as of now, both implementations have roughly the same speed. I will close this PR, but leave the branch on github. If we later (whenever you have time; we are no longer in a hurry) find enough evidence that rtdists is to be favored overall, we can open this PR again. |
Hi Paul, I would like to repoen this issue and discussion. I currently have a large fitted brms diffusion model (with 177K observations from 140 participants) for which I simply cannot get posterior predictives with I have since changed the RNG to the one from
I have run the exact same code for the Thus, it seems that for some parameter sets, Please note that the implementation on my github (https://github.com/singmann/brms) is pretty hacky, but it uses the Let me know if there is anything I can provide or if you think there is a way to let the user choose which RNG to use or to specify additional arguments to the RNG. Best, |
I think a good code structure could be to have an argument in the wiener distribution functions to specify which package to use for internal computation, so that both are available. What remains to be done then is to have an additional argument in |
That sounds like an ideal solution. Let me know if you want my input on anything. |
I will. Thank you! |
I have updated the brms master branch to support the rtdists backend as well. Would you mind double checking the code related to rtdists? Here are some examples: set.seed(1234)
n <- 10
x <- seq(0.1, 1, 0.1)
alpha <- rexp(n)
tau <- 0.05
beta <- 0.5
delta <- rnorm(n)
resp <- sample(c(0, 1), n, TRUE)
dwiener(x, alpha, tau, beta, delta, resp, backend = "Rwiener")
dwiener(x, alpha, tau, beta, delta, resp, backend = "rtdists")
rwiener(n, alpha, tau, beta, delta, backend = "Rwiener")
rwiener(n, alpha, tau, beta, delta, backend = "rtdists") One can set the preferred backend globally for the current R session: set.seed(0)
RT <- rbind(cbind(rwiener(100, 2, .3, .5, 0), grp = "A"),
cbind(rwiener(100, 2, .3, .5, 1), grp = "B"))
names(RT)[1] <- "rt"
fit_wiener <- brm(rt | dec(resp) ~ grp, data = RT,
family = wiener())
# default anyway
options(wiener_backend = "Rwiener")
pp_check(fit_wiener)
loo(fit_wiener)
# alternative backend
options(wiener_backend = "rtdists")
pp_check(fit_wiener)
loo(fit_wiener) I will close this PR as I directly updated master with the new feature. |
@singmann would you mind reviewing the PR if I use rtdists correctly?