Skip to content
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

Bayesian bootstrap for uncertainty estimates #41

Closed
2 tasks
avehtari opened this issue Feb 8, 2017 · 4 comments
Closed
2 tasks

Bayesian bootstrap for uncertainty estimates #41

avehtari opened this issue Feb 8, 2017 · 4 comments
Assignees
Labels

Comments

@avehtari
Copy link
Collaborator

avehtari commented Feb 8, 2017

Summary:
Add

  • Function for Bayesian bootstrap
  • Function for getting BB-samples describing the predictive performance uncertainty

Description:
Bayesian bootstrap can be used to get samples from the distribution of LOO predictive performance estimate. Bayesian bootstrap is equal to Dirichlet distribution model. Function should have optional arguments for alpha and random seed. Alpha not equal to 1, is needed later. Same random seed allows easier comparison of models. See Aki Vehtari and Jouko Lampinen (2002). Bayesian model assessment and comparison using cross-validation predictive densities. Neural Computation, 14(10):2439-2468.

Example code with log score (and seed for Dirichlet not fixed)

data(radon)
y<-radon$log_radon
## Fit the first model
modelA <- stan_lmer(
    log_radon ~ floor + log_uranium + floor:log_uranium + (1 + floor | county),
    data = radon,
    cores = 4,
    iter = 2000,
    chains = 4)
looA<-loo(modelA)
loos<-looA$pointwise[,1]
## number of observations
N<-length(loos)
## number of BB-samples
nb<-10000
## Dirichlet alpha
alpha<-1
## nb samples from the Dirichlet distribution
library(extraDistr)
dirw<-rdirichlet(nb,matrix(alpha,1,N))
## BB-samples from elppd
bbelppd=rowSums(t(t(as.matrix(dirw))*as.vector(loos)))*N

@jgabry
Copy link
Member

jgabry commented Apr 22, 2018

@avehtari can we close this now that BB is added in loo 2? Or do you want this as something separate/additional?

Sent with GitHawk

@avehtari
Copy link
Collaborator Author

Let's discuss this next week

@ParadaCarleton
Copy link

ParadaCarleton commented Jun 12, 2021

Unsure how much of this was ever implemented -- if it was, it should probably be emphasized more in the vignettes, since I didn't see anything related to it besides a small mention that it can be used as part of model stacking algorithms. (Although I may have missed it!)

If the Bayesian bootstrap has been added, histospline smoothing may be worth looking at for improving inference with small samples. I'm not 100% sure whether BCa can be extended to the Bayesian bootstrap as well, but if so, that might be interesting to add later on.

@avehtari
Copy link
Collaborator Author

Bayesian bootstrap is used by loo_model_weights() which has documentation with examples.

Based on https://arxiv.org/abs/2008.10296 and related additional experiments, it seems the benefit of Bayesian bootstrap in uncertainty estimate is smaller than what I assumed in 2017 when creating this issue. I close this now. If you are interested in histospline, the discussion related to would be better elsewhere or in a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants