library(RobustGaSP)
###parallel partial Gaussian stochastic process (PP GaSP) model
##for the humanity model
data(humanity_model)
##120 runs. The input has 13 variables and output is 5 dimensional.
##PP GaSP Emulator
m.ppgasp=ppgasp(design=humanity.X,response=humanity.Y,nugget.est= TRUE)
show(m.ppgasp)
##make predictions
m_pred=predict(m.ppgasp,humanity.Xt)
sqrt(mean((m_pred$mean-humanity.Yt)^2))
mean(m_pred$upper95>humanity.Yt & humanity.Yt>m_pred$lower95)
mean(m_pred$upper95-m_pred$lower95)
sqrt( mean( (mean(humanity.Y)-humanity.Yt)^2 ))
##with a linear trend on the selected input performs better
if (FALSE) {
###PP GaSP Emulation with a linear trend for the humanity model
data(humanity_model)
##pp gasp with trend
n<-dim(humanity.Y)[1]
n_testing=dim(humanity.Yt)[1]
H=cbind(matrix(1,n,1),humanity.X$foodC)
H_testing=cbind(matrix(1,n_testing,1),humanity.Xt$foodC)
m.ppgasp_trend=ppgasp(design=humanity.X,response=humanity.Y,trend=H,
nugget.est= TRUE)
show(m.ppgasp_trend)
##make predictions
m_pred_trend=predict(m.ppgasp_trend,humanity.Xt,testing_trend=H_testing)
sqrt(mean((m_pred_trend$mean-humanity.Yt)^2))
mean(m_pred_trend$upper95>humanity.Yt & humanity.Yt>m_pred_trend$lower95)
mean(m_pred_trend$upper95-m_pred_trend$lower95)
}
Run the code above in your browser using DataLab