Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Jackknife(+) Predictive Intervals for Bayesian Models

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

CoryMcCartan/conformalbayes

Repository files navigation

CRAN statusLifecycle: experimentalLicense: MITR-CMD-check

conformalbayes provides functions to construct finite-samplecalibrated predictive intervals for Bayesian models, following theapproach inBarber et al. (2021).These intervals are calculated efficiently using importance sampling forthe leave-one-out residuals. By default, the intervals will also reflectthe relative uncertainty in the Bayesian model, using thelocally-weighted conformal methods ofLei etal. (2018).

Installation

You can install the development version ofconformalbayes with:

# install.packages("devtools")devtools::install_github("CoryMcCartan/conformalbayes")

Example

library(rstanarm)library(conformalbayes)data("Loblolly")fit_idx= sample(nrow(Loblolly),50)d_fit=Loblolly[fit_idx, ]d_test=Loblolly[-fit_idx, ]# fit a simple linear regressionm= stan_glm(height~ sqrt(age),data=d_fit,chains=1,control=list(adapt_delta=0.999),refresh=0)# prepare conformal predictionsm= loo_conformal(m)# make predictive intervalspred_ci= predictive_interval(m,newdata=d_test,prob=0.9)print(head(pred_ci))#>             5%       95%#> 1  -0.15888598  5.600095#> 29 25.43314599 30.988491#> 57 48.67648127 54.182655#> 2  -0.09561987  5.447242#> 30 25.42970114 30.938488#> 72 58.01173187 63.596592# are we covering?mean(pred_ci[,"5%"]<=d_test$height&d_test$height<=pred_ci[,"95%"])#> [1] 0.9117647

Read more on theGetting Startedpage.

Citations

Barber, R. F., Candes, E. J., Ramdas, A., & Tibshirani, R. J. (2021).Predictive inference with the jackknife+.The Annals of Statistics,49(1), 486-507.

Lei, J., G’Sell, M., Rinaldo, A., Tibshirani, R. J., & Wasserman, L.(2018). Distribution-free predictive inference for regression.Journalof the American Statistical Association, 113(523), 1094-1111.

About

Jackknife(+) Predictive Intervals for Bayesian Models

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp