intervals {evreg} | R Documentation |
intervals
computes probabilistic and belief prediction intervals from a prediction object
returned by function predict.ENNreg
.
intervals(pred, level = 0.9, yt = NULL)
pred |
Prediction object returned by function |
level |
Level of the prediction interval (between 0 and 1). |
yt |
Optional vector of test response values. |
A list with four elements:
Matrix (n,2) of probabilistic prediction intervals.
Matrix (n,2) of belief prediction intervals.
Estimated coverage rate of the probabilistic intervals (if yt is provided).
Estimated coverage rate of the belief intervals (if yt is provided).
Mean plausibility of the belief intervals.
library(MASS)
X<-as.matrix(scale(Boston[,1:13]))
y<-Boston[,14]
set.seed(220322)
n<-nrow(Boston)
ntrain<-round(0.7*n)
train <-sample(n,ntrain)
fit <- ENNreg(X[train,],y[train],K=30)
pred<-predict(fit,newdata=X[-train,],yt=y[-train])
int<- intervals(pred,level=0.95,y[-train])
print(c(int$coverage.P,int$coverage.Bel))