Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rizbicki/predictionBands
R package to compute distribution-free prediction bands using density estimators
https://github.com/rizbicki/predictionBands
Last synced: about 1 month ago
JSON representation
R package to compute distribution-free prediction bands using density estimators
- Host: GitHub
- URL: https://github.com/rizbicki/predictionBands
- Owner: rizbicki
- Created: 2019-10-12T14:26:34.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-26T18:10:39.000Z (over 3 years ago)
- Last Synced: 2024-02-13T08:04:28.628Z (10 months ago)
- Language: R
- Size: 35.2 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-conformal-prediction - Prediction Bands
README
# predictionBands
R package to compute distribution-free prediction bands using density estimators according toIzbicki, R., Shimizu, G. Y., Stern, R. B. (2019). [Flexible distribution-free conditional predictive bands using density estimators](http://proceedings.mlr.press/v108/izbicki20a.html).
The package estimates conditional densities using [FlexCode](https://github.com/rizbicki/FlexCoDE/). (More on FlexCoDE: Izbicki, R.; Lee, A.B. [Converting High-Dimensional Regression to High-Dimensional Conditional Density Estimation](https://projecteuclid.org/euclid.ejs/1499133755). Electronic Journal of Statistics, 2017)
Two types of bands are available: 'dist-split' returns intervals (ideal for unimodal response distributions); 'cd-split' returns unions of intervals (ideal for multimodal response distributions)
To install the package, run
```R
# install.packages("devtools")
devtools::install_github("rizbicki/FlexCoDE")
devtools::install_github("rizbicki/predictionBands")
```
(this package requires FlexCoDE).A simple example:
```R
library(predictionBands)library(FlexCoDE)
n<-1000
n_new<-50
d<-10
data<-matrix(NA,n,d+1)
x<-matrix(rnorm(n*d),n,d)
y<-x[,1]+rnorm(n,0,0.1)# fit predictionBands object
fit<-fit_predictionBands(x,y,0.5,0.4,0.1)# generate new data:
xnew<-matrix(rnorm(n_new*d),n_new,d)
ynew<-xnew[,1]+rnorm(n_new,0,0.1)# compute prediction bands for new data:
#Dist-split
bands<-predict(fit,xnew,type="dist")
plot(bands)
plot(bands,ynew) # if ynew is available#CD-split
bands<-predict(fit,xnew,type="cd")
plot(bands)
plot(bands,ynew) # if ynew is available#Hpd-split
bands<-predict(fit,xnew,type="hpd")
#bands[[1]]
#bands[[2]]
plot(bands)
plot(bands,ynew) # if ynew is available
```