mjskay / tidybayes

Bayesian analysis + tidy data + geoms (R package)
http://mjskay.github.io/tidybayes
GNU General Public License v3.0
712 stars 59 forks source link

Random lockups with add_draws() #253

Closed FrankD closed 3 years ago

FrankD commented 4 years ago

What actually happens when you invoke the add_draws type functions on a brms object? The reason I'm asking is that I was using tidybayes for the first time today to get a residual plot, and add_residual_draws() locks up my computer 9 times out of 10. My computer is prone to lockups anyway, so I don't think it's necessarily the fault of tidybayes, but I'd like to understand better what is happening so I can figure out a way around it. Does this function invoke brms() or rstan to generate these draws of the residuals?

If it's helpful, this is happening on Linux Mint, R 3.6.3, and the data I'm working with has a very large number of observations (51K). I am however able to fit the brms model without a lockup.

mjskay commented 4 years ago

hmm good question. The easiest way to debug stuff like this tends to be to use a profiler --- I like profvis. I would suggest running it on a subset of your data (maybe a smaller version of the same model) as profilers tend to take a little bit more time to run than just running the code raw. But it should tell you what functions are being used under the hood that take a long time to run.

I would be very curious what the output of the profiler looks like --- it would help me figure out if it's something I can fix in tidybayes that would make it run faster.

mjskay commented 3 years ago

Closing this issue as old. Feel free to reopen if you are still having problems on the latest version; output of a profiler would help me diagnose this source of the problem.