if (FALSE) {
#Analysis of Crime Data
#load data
data(UScrime)
crime.Bvs<- Bvs(formula= y ~ ., data=UScrime, n.keep=1000)
#predict a future observation associated with the first two sets of covariates
crime.Bvs.predict<- predict(crime.Bvs, newdata=UScrime[1:2,], n.sim=10000)
#(Notice the best 1000 models are used in the mixture)
#Here you can use standard summaries to describe the underlying predictive distribution
#summary(crime.Bvs.predict)
#
#To study more in deep the first set:
plot(density(crime.Bvs.predict[,1]))
#Point prediction
median(crime.Bvs.predict[,1])
#A credible 95% interval for the prediction:
#lower bound:
quantile(crime.Bvs.predict[,1], probs=0.025)
#upper bound:
quantile(crime.Bvs.predict[,1], probs=0.975)
}
Run the code above in your browser using DataLab