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
Add loo_subsample and loo_approximate_posterior #113
Conversation
I think we are getting very close to having this PR ready. With the current
I cannot tell whether this happens because of brms or loo but I think it would be good to figure this out before merging. Here is a reproducible example: devtools::install_github("paul-buerkner/brms", ref = "ssloo")
library(brms)
fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient),
data = epilepsy, family = poisson())
loo_subsample(fit1) |
Great. I just pushed some final fixes for the documentation, generics etc. Hopefully this will also fix the two failing test cases, but that remains to be seen. The problem you encountered is that the default subsample size is 400 and the epilepsy dataset contain roughly 250 observations. Now it throws an error. I tried to make the error more clear. But maybe we should just set the observation to the full dataset and trow a warning instead? |
Ah, this makes sense. Sorry this was my bad. I think the error is clear. Perhaps one could say Argument 'observations' to make clear this is something the user can simply change? Or also point out the number i.e. 400 and 250 in this case? |
Codecov Report
@@ Coverage Diff @@
## master #113 +/- ##
==========================================
- Coverage 98.4% 95.29% -3.11%
==========================================
Files 16 19 +3
Lines 1252 2020 +768
==========================================
+ Hits 1232 1925 +693
- Misses 20 95 +75
Continue to review full report at Codecov.
|
I forgot to answer this good question from @MansMeg:
It’s only possible if we know the chain_id for each draw, which we do in the array case (possibly the function case), but not the matrix case without the user supplying a chain_id variable. So I think @avehtari and I decided that loo methods in other packages like rstanarm and brms can compute r_eff automatically but the primary loo methods in loo would take r_eff as an input. We could change this (I think without breaking backwards compatibility) if there’s a good reason. |
Ah. Of course, it totally makes sense. I assumed we "knew" the chain structure. |
Hi!
Here come loo_subsample and loo_approximate_posterior functionality.
Implementation question/issues
Technical questions/issues