Gaussian stochastic process (GaSP) emulation is a powerful tool for approximating computationally intensive computer models. However, estimation of parameters in the GaSP emulator is a challenging task. No closed-form estimator is available and many numerical problems arise with standard estimates, e.g., the maximum likelihood estimator. In this package, we implement a marginal posterior mode estimator, for special priors and parameterizations. This estimation method that meets the robust parameter estimation criteria was discussed in (Gu et al. 2018); mathematical reasons are provided therein to explain why robust parameter estimation can greatly improve predictive performance of the emulator. In addition, inert inputs (inputs that almost have no effect on the variability of a function) can be identified from the marginal posterior mode estimation at no extra computational cost. The package also implements the parallel partial Gaussian stochastic process (PP GaSP) emulator ((Gu and Berger 2016)) for the scenario where the computer model has multiple outputs on, for example, spatial-temporal coordinates. The package can be operated in a default mode, but also allows numerous user specifications, such as the capability of specifying trend functions and noise terms. Examples are studied herein to highlight the performance of the package in terms of out-of-sample prediction.
A GaSP emulator is a fast surrogate model used to approximate the outcomes of a computer model ((Sacks et al. 1989; Bayarri et al. 2007; Paulo et al. 2012; Palomo et al. 2015; Gu and Berger 2016)). The prediction accuracy of the emulator often depends strongly on the quality of the parameter estimates in the GaSP model. Although the mean and variance parameters in the GaSP model are relatively easy to deal with, estimation of parameters in the correlation functions is difficult ((Kennedy and O’Hagan 2001)). Standard methods of estimating these parameters, such as maximum likelihood estimation (MLE), often produce unstable results leading to inferior prediction. As shown in ((Gu et al. 2018)), the GaSP emulator is unstable when the correlation between any two different inputs are estimated to be close to one or to zero. The former case causes a near singularity when inverting the covariance matrix (this can partially be addressed by adding a small nugget ((Andrianakis and Challenor 2012))), while the latter problem happens more often and has no easy fix.
There are several packages on the Comprehensive R Archive Network (CRAN, https://CRAN.R-project.org/) which implement the GaSP model based on the MLE, including DiceKriging ((Roustant et al. 2012)), GPfit ((MacDonald et al. 2015)), mleGP ((Dancik 2013)), spatial ((Venables and Ripley 2002)), and fields ((Nychka et al. 2016)). In these packages, bounds on the parameters in the correlation function are typically implemented to overcome the numerical problems with the MLE estimates. Predictions are, however, often quite sensitive to the choice of bound, which is essentially arbitrary, so this is not an appealing fix to the numerical problems.
In (Gu 2016), marginal posterior modes based on several objective priors are studied. It has been found that certain parameterizations result in more robust estimators than others, and, more importantly, that some parameterizations which are in common use should clearly be avoided. Marginal posterior modes with the robust parameterization are mathematically stable, as the posterior density is shown to be zero at the two problematic cases–when the correlation is nearly equal to one or to zero. This motivates the RobustGaSP package; examples also indicate that the package results in more accurate in out-of-sample predictions than previous packages based on the MLE. We use the DiceKriging package in these comparisons, because it is a state-of-the-art implementation of the MLE methodology
The RobustGaSP package ((Gu et al. 2016)) for R builds a GaSP emulator with robust parameter estimation. It provides a default method with regard to a specific correlation function, a mean/trend function and an objective prior for the parameters. Users are allowed to specify them, for example, by using a different correlation and/or trend function, another prior distribution, or by adding a noise term with either a fixed or estimated variance. Although the main purpose of the RobustGaSP package is to do emulation/approximation of a complex function, this package can also be used in fitting the GaSP model for other purposes, such as nonparameteric regression, modeling spatial data and so on. For computational purposes, most of the time consuming functions in the RobustGaSP package are implemented in C++.
We highlight several contributions of this work. First of all, to compute the derivative of the reference prior with a robust parametrization in ((Gu et al. 2018)) is computationally expensive, however this information is needed to find the posterior mode by the low-storage quasi-Newton optimization method ((Nocedal 1980)). We introduce a robust and computationally efficient prior, called the jointly robust prior ((Gu 2018)), to approximate the reference prior in the tail rates of the posterior. This has been implemented as a default setting in the RobustGaSP package.
Furthermore, the use of the jointly robust prior provides a natural
shrinkage for sparsity and thus can be used to identify inert/noisy
inputs (if there are any), implemented in the findInertInputs
function
in the RobustGaSP package. A formal approach to Bayesian model
selection requires a comparison of findInertInputs
function in the
RobustGaSP package can be used, as a fast pre-experimental check, to
separate the influential inputs and inert inputs in highly nonlinear
computer model outputs.
The RobustGaSP package also provides some regular model checks in fitting the emulator, while the robustness in the predictive performance is the focus in (Gu et al. 2018). More specifically, the leave-one-out cross validation, standardized residuals and Normal QQ-plot of the standardized residuals are implemented and will be introduced in this work.
Lastly, some computer models have multiple outputs. For example, each
run of the TITAN2D simulator produces up to
The rest of the paper is organized as follows. In the next section, we briefly review the statistical methodology of the GaSP emulator and the robust posterior mode estimation. In Section 3, we describe the structure of the package and highlight the main functions implemented in this package. In Section 4, several numerical examples are provided to illustrate the behavior of the package under different scenarios. In Section 5, we present conclusions and briefly discuss potential extensions. Examples will be provided throughout the paper for illustrative purposes.
Prior to introducing specific functions and usage of the RobustGaSP
package, we first review the statistical formulation of the GaSP
emulator of the computer model with real-valued scalar outputs. Let
The
The Matérn correlation is commonly used in modeling spatial data
((Stein 2012)) and has recently been advocated for computer
model emulation ((Gu et al. 2018)); one benefit is that the roughness
parameter of the Matérn correlation directly controls the smoothness of
the process. For example, the Matérn correlation with
Matérn |
|
Matérn |
|
Power exponential |
Since the simulator is expensive to run, we will at most be able to
evaluate
The parameters in a GaSP emulator include mean parameters, a variance
parameter, and range parameters, denoted as
The reference prior
The range parameters
Various functions implemented in the RobustGaSP package can be reused
in other studies. log_marginal_lik
and log_marginal_lik_deriv
give
the natural logarithm of the marginal likelihood in ((5))
and its directional derivatives with regard to neg_log_marginal_post_ref
gives the negative values of the log
marginal posterior distribution and thus one can use
-neg_log_marginal_post_ref
minus log_marginal_lik
to get the log
reference prior. The jointly robust prior log_approx_ref_prior
and log_approx_ref_prior_deriv
, respectively.
All these functions are not implemented in other packages and can be
reused in other theoretical studies and applications.
After obtaining
The emulator interpolates the simulator at the design points
We now provide an example in which the input has one dimension, ranging
from
R> library(RobustGaSP)
R> library(lhs)
R> set.seed(1)
R> input <- 10 * maximinLHS(n=15, k=1)
R> output <- higdon.1.data(input)
R> model <- rgasp(design = input, response = output)
R> model
Call:
rgasp(design = input, response = output)
Mean parameters: 0.03014553
Variance parameter: 0.5696874
Range parameters: 1.752277
Noise parameter: 0
higdon.1.data
function in the RobustGaSP package.The fourth line of the code generates 15 LH samples at maximinLHS
function of the
lhs package ((Carnell 2016)).
The function higdon.1.data
is provided within the RobustGaSP package
which has the form
The plot
function in RobustGaSP package implements the leave-one-out
cross validation for a "rgasp"
class after the GaSP model is built
(see Figure 1 for its output):
R> plot(model)
The prediction at a set of input points can be done by the following code:
R> testing_input <- as.matrix(seq(0, 10, 1/50))
R> model.predict<-predict(model, testing_input)
R> names(model.predict)
[1] "mean" "lower95" "upper95" "sd"
The predict
function generates a list containing the predictive mean,
lower and upper
R> testing_output <- higdon.1.data(testing_input)
R> plot(testing_input, model.predict$mean,type='l', col='blue',
+ xlab='input', ylab='output')
R> polygon( c(testing_input,rev(testing_input)), c(model.predict$lower95,
+ rev(model.predict$upper95)), col = "grey80", border = F)
R> lines(testing_input, testing_output)
R> lines(testing_input,model.predict$mean, type='l', col='blue')
R> lines(input, output, type='p')
It is also possible to sample from the predictive distribution (which is
a multivariate
R> model.sample <- simulate(model, testing_input, num_sample=10)
R> matplot(testing_input, model.sample, type='l', xlab='input', ylab='output')
R> lines(input, output,type='p')
The plots of 10 posterior predictive samples are shown in Figure 3.
Some inputs have little effect on the output of a computer model. Such inputs are called inert inputs ((Linkletter et al. 2006)). To quantify the influence of a set of inputs on the variability of the outputs, functional analysis of the variance (functional ANOVA) can be used, often implemented through Sobol’s Indices ((Sobol’ 1990; Sobol 2001)). Methods for numerical calculation of Sobol’s Indices have been implemented in the sensitivity package ((Pujol et al. 2016)) for R.
The identification of inert inputs through the posterior modes with the
jointly robust prior (threshold
in the function
findInertInputs
.
For demonstration purpose, we build a GaSP emulator for the borehole
experiment
((Worley 1987; Morris et al. 1993; An and Owen 2001)), a
well-studied computer experiment benchmark which models water flow
through a borehole. The output
R> set.seed(1)
R> input <- maximinLHS(n=40, k=8) # maximin lhd sample
R> # rescale the design to the domain of the borehole function
R> LB <- c(0.05, 100, 63070, 990, 63.1, 700, 1120, 9855)
R> UB <- c(0.15, 50000, 115600, 1110, 116, 820, 1680, 12045)
R> range <- UB - LB
R> for(i in 1:8) {
R> input[,i] = LB[i] + range[i] * input[,i]
R> }
R> num_obs <- dim(input)[1]
R> output <- matrix(0,num_obs,1)
R> for(i in 1:num_obs) {
+ output[i] <- borehole(input[i,])
+ }
R> m <- rgasp(design = input, response = output, lower_bound=FALSE)
R> P <- findInertInputs(m)
The estimated normalized inverse range parameters are : 3.440765 8.13156e-09
4.983695e-09 0.844324 4.666519e-09 1.31081 1.903236 0.5008652
The inputs 2 3 5 are suspected to be inert inputs
Similar to the automatic relevance determination model in neural
networks, e.g. (MacKay 1996; Neal 1996), and in machine
learning, e.g. (Tipping 2001; Li et al. 2002), the function
findInertInputs
of the RobustGaSP package indicates that the
The ideal situation for a computer model is that it produces noise-free data, meaning that the output will not change at the same input. However, there are several cases in which the outputs are noisy. First of all, the numerical solution of the partial differential equations of a computer model could introduce small errors. Secondly, when only a subset of inputs are analyzed, the computer model is no longer deterministic given only the subset of inputs. For example, if we only use the 5 influential inputs of the borehole function, the outcomes of this function are no longer deterministic, since the variation of the inert inputs still affects the outputs a little. Moreover, some computer models might be stochastic or have random terms in the models.
For these situations, the common adjustment is to add a noise term to
account for the error, such as
Objective Bayesian analysis for the proposed GaSP model with the noise
term can be done by defining the prior
As in the previous noise-free GaSP model, one can estimate the range and
nugget-variance ratio parameters by their marginal maximum posterior
modes
After obtaining
Using only the influential inputs of the borehole function, we construct the GaSP emulator with a nugget based on 30 maximin LH samples through the following code:
R> m.subset <- rgasp(design = input[ ,c(1,4,6,7,8)], response = output,
+ nugget.est=TRUE)
R> m.subset
Call:
rgasp(design = input[, c(1, 4, 6, 7, 8)], response = output,
nugget.est = TRUE)
Mean parameters: 170.9782
Variance parameter: 229820.7
Range parameters: 0.2489396 1438.028 1185.202 5880.335 44434.42
Noise parameter: 0.2265875
To compare the performance of the emulator with and without a noise term, we perform some out-of-sample testing. We build the GaSP emulator by the RobustGaSP package and the DiceKriging package using the same mean and covariance. In RobustGaSP, the parameters in the correlation functions are estimated by marginal posterior modes with the robust parameterization, while in DiceKriging, parameters are estimated by MLE with upper and lower bounds. We first construct these four emulators with the following code.
R> m.full <- rgasp(design = input, response = output)
R> m.subset <- rgasp(design = input[ ,c(1,4,6,7,8)], response = output,
+ nugget.est=TRUE)
R> dk.full <- km(design = input, response = output)
R> dk.subset <- km(design = input[ ,c(1,4,6,7,8)], response = output,
+ nugget.estim=TRUE)
We then compare the performance of the four different emulators at 100 random inputs for the borehole function.
R> set.seed(1)
R> dim_inputs <- dim(input)[2]
R> num_testing_input <- 100
R> testing_input <- matrix(runif(num_testing_input*dim_inputs),
+ num_testing_input,dim_inputs)
R> for(i in 1:8) {
R> testing_input[,i] <- LB[i] + range[i] * testing_input[,i]
R> }
R> m.full.predict <- predict(m.full, testing_input)
R> m.subset.predict <- predict(m.subset, testing_input[ ,c(1,4,6,7,8)])
R> dk.full.predict <- predict(dk.full, newdata = testing_input,type = 'UK')
R> dk.subset.predict <- predict(dk.subset,
+ newdata = testing_input[ ,c(1,4,6,7,8)],type = 'UK')
R> testing_output <- matrix(0, num_testing_input, 1)
R> for(i in 1:num_testing_input) {
+ testing_output[i] <- borehole(testing_input[i, ])
+ }
R> m.full.error <- abs(m.full.predict$mean - testing_output)
R> m.subset.error <- abs(m.subset.predict$mean - testing_output)
R> dk.full.error <- abs(dk.full.predict$mean - testing_output)
R> dk.subset.error <- abs(dk.subset.predict$mean - testing_output)
Since the DiceKriging package seems not to have implemented a method to estimate the noise parameter, we only compare it with the nugget case. The box plot of the absolute errors of these 4 emulators (all with the same correlation and mean function) at 100 held-out points are shown in Figure 5. The performance of the RobustGaSP package based on the full set of inputs or only influential inputs with a noise is similar, and they are both better than the predictions from the DiceKriging package.
The main purpose of the RobustGaSP package is to predict a function at
unobserved points based on only a limited number of evaluations of the
function. The uncertainty associated with the predictions is obtained
from the predictive distribution in Equation
((7)), which is implemented in two steps. The
first step is to build a GaSP model through the rgasp
function. This
function allows users to specify the mean function, correlation
function, prior distribution for the parameters, and to include a noise
term or not. In the default setting, these are all specified. The mean
and variance parameters are handled in a fully Bayesian way, and the
range parameters in the correlation function are estimated by their
marginal posterior modes. Moreover, users can also fix the range
parameters, instead of estimating them, change/replace the mean
function, add a noise term, etc. The rgasp
function returns an object
of the "rgasp"
S4 class with all needed estimated parameters,
including the mean, variance, noise and range parameters to perform
predictions.
The second step is to compute the predictive distribution of the
previously created GaSP model through the predict
function, which
produces the predictive means, the simulate
function.
The identification of inert inputs can be performed using the
findInertInput
function. As it only depends on the inverse range
parameters through Equation ((9)), there is no extra
computational cost in their identification (once the robust GaSP model
has been built through the rgasp
function). We suggest using the
jointly robust prior by setting the argument prior_choice="ref_approx"
in the rgasp
function before calling the findInertInput
function,
because the penalty given by this prior is close to an
Besides, the RobustGaSP package also implements the PP GaSP emulator
introduced in (Gu and Berger 2016) for the computer model with a vector of
outputs. In the PP GaSP emulator, the variances and the mean values of
the computer model outputs at different grids are allowed to be
different, whereas the covariance matrix of physical inputs are assumed
to be the same across grids. In estimation, the variance and the mean
parameters are first marginalized out with the reference priors. Then
the posterior mode is used for estimating the parameters in the kernel.
The ppgasp
function builds a PP GaSP model, which returns an object of
the "ppgasp"
S4 class with all needed estimated parameters. Then the
predictive distribution of PP GaSP model is computed through the
predict.ppgasp
function. Similar to the emulator of the output with
the scalar output, the predict.ppgasp
function returns the predictive
means, the
rgasp
functionThe rgasp
function is one of the most important functions, as it
performs the parameter estimation for the GaSP model of the computer
model with a scalar output. In this section, we briefly review the
implementation of the rgasp
function and its optimization algorithm.
The rgasp
function. The
default setting in the argument trend
is a constant function, i.e.,
zero.mean=TRUE
in the rgasp
function to assume the mean function in
GaSP model is zero. By default, the GaSP model is defined to be
noise-free, i.e., the noise parameter is nugget.est = T
in the rgasp
function; when the nugget-variance
parameter rgasp
and
Two classes of priors of the form ((4)), with several
different robust parameterizations, have been implemented in the
RobustGaSP package (see Table 3 for details). The
prior that will be used is controlled by the argument prior_choice
in
the rgasp
function. The reference prior prior_choice="ref_gamma"
and
prior_choice="ref_xi"
, respectively. The jointly robust prior
prior_choice="ref_approx"
; this is the default choice used in rgasp
,
for the reasons discussed in Section 2.
The correlation functions implemented in the RobustGaSP package are
shown in Table 1, with the default setting being
kernel_type = "matern_5_2"
in the rgasp
function. The power
exponential correlation function requires the specification of a vector
of roughness parameters alpha
in
the rgasp
function; the default value is
ppgasp
functionThe ppgasp
function performs the parameter estimation of the PP GaSP
emulator for the computer model with a vector of outputs. In the
ppgasp
function, the output ppgasp
function and rgasp
function are the same.
Thus the ppgasp
function return the estimated parameters, including
Estimation of the range parameters lbfgs
function in the
nloptr package
((Ypma 2014)) for optimization. The closed-form marginal likelihood,
prior and their derivatives are all coded in C++. The maximum number of
iterations and tolerance bounds are allowed to be chosen by users with
the default setting as max_eval=30
and xtol_rel=1e-5
, respectively.
Although maximum marginal posterior mode estimation with the robust
parameterization eliminates the problems of the correlation matrix being
estimated to be either rgasp
function through the argument lower_bound=TRUE
, and this is the
default setting in RobustGaSP. As use of the bound is a somewhat ad
hoc fix for numerical problems, we encourage users to also try the
analysis without the bound; this can be done by specifying
lower_bound=FALSE
. If the answers are essentially unchanged, one has
more confidence that the parameter estimates are satisfactory.
Furthermore, if the purpose of the analysis is to detect inert inputs,
users are also suggested to use the argument lower_bound=FALSE
in the
rgasp
function.
Since the marginal posterior distribution could be multi-modal, the
package allows for different initial values in the optimization by
setting the argument multiple_starts=TRUE
in the rgasp
function. The
first default initial value for each inverse range parameter is set to
be
In this section, we present further examples of the performance of the
RobustGaSP package, and include comparison with the DiceKriging
package in R. We will use the same data, trend function, and correlation
function for the comparisons. The default correlation function in both
packages is the Matérn correlation with
It is expected that, for a one-dimensional function, both packages will
perform well with an adequate number of design points, so we start with
the function called the modified sine wave discussed in (Gu 2016).
It has the form
R> sinewave <- function(x) {
+ 3*sin(5*pi*x)*x + cos(7*pi*x)
+ }
R> input <- as.matrix(seq(0, 1, 1/11))
R> output <- sinewave(input)
The GaSP model is fitted by both the RobustGaSP and DiceKriging packages, with the constant mean function.
R> m <- rgasp(design=input, response=output)
R> m
Call:
rgasp(design = input, response = output)
Mean parameters: 0.1402334
Variance parameter: 2.603344
Range parameters: 0.04072543
Noise parameter: 0
R> dk <- km(design = input, response = output)
R> dk
Call:
km(design = input, response = output)
Trend coeff.:
Estimate
(Intercept) 0.1443
Covar. type : matern5_2
Covar. coeff.:
Estimate
theta(design) 0.0000
Variance estimate: 2.327824
A big difference between two packages is the estimated range parameter,
which is found to be around 0.04 in the RobustGaSP package, whereas it
is found to be very close to zero in the DiceKriging package. To see
which estimate is better, we perform prediction on 100 test points,
equally spaced in
R> testing_input <- as.matrix(seq(0, 1, 1/99))
R> m.predict <- predict(m, testing_input)
R> dk.predict <- predict(dk, testing_input, type='UK')
The emulation results are plotted in Figure 6.
Note that the red curve from the DiceKriging package degenerates to
the fitted mean with spikes at the design points. This unsatisfying
phenomenon, discussed in (Gu et al. 2018), happens when the estimated
covariance matrix is close to an identity matrix, i.e.,
The predictive mean from the RobustGaSP package is plotted as the blue
curve in Figure 6 and is quite accurate as an
estimate of the true function. Note, however, that the uncertainty in
this prediction is quite large, as shown by the wide
In this example, adding a nugget is not helpful in DiceKriging, as the
problem is that
It is somewhat of a surprise that even emulation of a smooth one-dimensional function can be problematical. The difficulties with a multi-dimensional input space can be considerably greater, as indicated in the next example.
The Friedman function was introduced in (Friedman 1991) and
is given by
R> input <- maximinLHS(n=40, k=5)
R> num_obs <- dim(input)[1]
R> output <- rep(0, num_obs)
R> for(i in 1:num_obs) {
+ output[i] <- friedman.5.data(input[i,])
+ }
R> m <-rgasp(design=input, response=output)
R> dk <- km(design=input, response=output)
Prediction on 200 test points, uniformly sampled from
R> dim_inputs <- dim(input)[2]
R> num_testing_input <- 200
R> testing_input <- matrix(runif(num_testing_input * dim_inputs),
+ num_testing_input, dim_inputs)
R> m.predict <- predict(m, testing_input)
R> dk.predict <- predict(dk, testing_input, type='UK')
To compare the performance, we calculate the root mean square errors
(RMSE) for both methods,
R> testing_output <- matrix(0, num_testing_input, 1)
R> for(i in 1:num_testing_input) {
+ testing_output[i] < -friedman.5.data(testing_input[i,])
+ }
R> m.rmse <- sqrt(mean((m.predict$mean - testing_output)^2))
R> m.rmse
[1] 0.2812935
R> dk.rmse <- sqrt(mean((dk.predict$mean - testing_output)^2))
R> dk.rmse
[1] 0.8901442
Thus the RMSE from RobustGaSP is 0.28, while the RMSE from
RobustGaSP is 0.89. The predictions versus the real outputs are
plotted in Figure 8. The black circles
correspond to the predictive means from the RobustGaSP package and are
closer to the real output than the red circles produced by the
DiceKriging package. Since both packages use the same correlation and
mean function, the only difference lies in the method of parameter
estimation, especially estimation of the range parameters,
The Friedman function has a linear trend associated with the
R> colnames(input) <- c("x1", "x2", "x3", "x4", "x5")
R> trend.rgasp <- cbind(rep(1, num_obs), input)
R> m.trend <- rgasp(design=input, response=output, trend=trend.rgasp)
R> dk.trend <- km(formula ~ x1 + x2 + x3 + x4 + x5, design=input, response=output)
R> colnames(testing_input) <- c("x1", "x2", "x3", "x4", "x5")
R> trend.test.rgasp <- cbind(rep(1, num_testing_input), testing_input)
R> m.trend.predict <- predict(m.trend, testing_input,
+ testing_trend=trend.test.rgasp)
R> dk.trend.predict <- predict(dk.trend, testing_input, type='UK')
R> m.trend.rmse <- sqrt(mean( (m.trend.predict$mean - testing_output)^2))
R> m.trend.rmse
[1] 0.1259403
R> dk.trend.rmse <- sqrt(mean((dk.trend.predict$mean - testing_output)^2))
R> dk.trend.rmse
[1] 0.8468056
Adding a linear trend does improve the out-of-sample prediction accuracy
of the RobustGaSP package; the RMSE decreases to
In addition to point prediction, it is of interest to evaluate the
uncertainties produced by the emulators, through study of out-of-sample
coverage of the resulting credible intervals and their average lengths,
R> prop.m <- length(which((m.predict$lower95 <= testing_output)
+ & (m.predict$upper95 >= testing_output))) / num_testing_input
R> length.m <- sum(m.predict$upper95 - m.predict$lower95) / num_testing_input
R> prop.m
[1] 0.97
R> length.m
[1] 1.122993
R> prop.dk <- length(which((dk.predict$lower95 <= testing_output)
+ & (dk.predict$upper95 >= testing_output))) / num_testing_input
R> length.dk <- sum(dk.predict$upper95 - dk.predict$lower95) / num_testing_input
R> prop.dk
[1] 0.97
R> length.dk
[1] 3.176021
The
When linear terms are assumed in the basis function of the GaSP
emulator,
R> prop.m.trend <- length(which((m.trend.predict$lower95 <= testing_output)
+ &(m.trend.predict$upper95 >= testing_output))) / num_testing_input
R> length.m.trend <- sum(m.trend.predict$upper95 -
+ m.trend.predict$lower95) / num_testing_input
R> prop.m.trend
[1] 1
R> length.m.trend
[1] 0.8392971
R> prop.dk.trend <- length(which((dk.trend.predict$lower95 <= testing_output)
+ & (dk.trend.predict$upper95 >= testing_output))) / num_testing_input
R> length.dk.trend <- sum(dk.trend.predict$upper95 -
+ dk.trend.predict$lower95) / num_testing_input
R> prop.dk.trend
[1] 0.985
R> length.dk.trend
[1] 3.39423
The
To see whether or not the differences in performance persists when the
sample size increases, the same experiment was run on the two emulators
with sample size
We illustrate the PP GaSP emulator through two computer model data sets. The first testbed is the ‘diplomatic and military operations in a non-warfighting domain’ (DIAMOND) computer model ((Taylor and Lane 2004)). For each given set of input variables, the dataset contains daily casualties from the 2nd and 6th day after the earthquake and volcanic eruption in Giarre and Catania. The input variables are 13-dimensional, including the speed of helicopter cruise and ground engineers, hospital and food supply capacity. The complete list of the input variables and the full data set are given in (Overstall and Woods 2016).
The RobustGaSP package includes a data set from the DIAMOND simulator, where the training and test output both contain the outputs from 120 runs of the computer model. The following code fit a PP GaSP emulator on the training data using 3 initial starting points to optimize the kernel parameters and an estimated nugget in the PP GaSP model. We then make prediction on the test inputs using the constructed PP GaSP emulator.
R> data(humanity_model)
R> m.ppgasp <- ppgasp(design=humanity.X ,response=humanity.Y,
+ nugget.est=TRUE, num_initial_values=3)
R> m_pred <- predict(m.ppgasp, humanity.Xt)
R> sqrt(mean((m_pred$mean - humanity.Yt)^2))
[1] 294.9397
R> sd(humanity.Yt)
[1] 10826.49
The predictive RMSE of the PP GaSP emulator is
R> n < -dim(humanity.Y)[1]
R> n_testing=dim(humanity.Yt)[1]
R> H <- cbind(matrix(1, n, 1), humanity.X$foodC)
R> H_testing <- cbind(matrix(1, n_testing, 1), humanity.Xt$foodC)
R> m.ppgasp_trend <- ppgasp(design=humanity.X, response=humanity.Y, trend=H,
+ nugget.est=TRUE, num_initial_values=3)
R> m_pred_trend <- predict(m.ppgasp_trend, humanity.Xt, testing_trend=H_testing)
R> sqrt(mean((m_pred_trend$mean - humanity.Yt)^2))
[1] 279.6022
The above result indicates the predictive RMSE of the PP GaSP emulator
becomes smaller when the food capacity is included in the mean function.
We also fit GaSP emulators by the DiceKriging package independently
for each daily output. We include the following two criteria.
RMSE | |||
---|---|---|---|
Independent GaSP emulator constant mean | 720.16 | 0.99000 | 3678.5 |
Independent GaSP emulator selected trend | 471.10 | 0.96667 | 2189.8 |
PP GaSP constant mean | 294.94 | 0.95167 | 1138.3 |
PP GaSP selected trend | 279.60 | 0.95333 | 1120.6 |
The predictive accuracy by the independent GaSP emulator by the DiceKriging and the PP GaSP emulator for the DIAMOND computer model is recorded in Table 4. First, we noticed the predictive accuracy of both emulators seems to improve with the food capacity included in the mean function. Second, the PP GaSP seems to have much lower RMSE than the Independent GaSP emulator by the DiceKriging in this example, even though the kernel used in both packages are the same. One possible reason is that estimated kernel parameters by the marginal posterior mode from the RobustGaSP are better. Nonetheless, the PP GaSP is a restricted model, as the covariance matrix is assumed to be the same across each output variable (i.e. casualties at each day in this example). This assumption may be unsatisfying for some applications, but the improved speed in computation can be helpful. We illustrate this point by the following example for the TITAN2D computer model.
In this section, we discuss an application of emulating the massive number of outputs on the spatio-temporal grids from the TITAN2D computer model ((Patra et al. 2005; Bayarri et al. 2009)). The TITAN2D simulates the volcanic eruption from Soufrière Hill Volcano on Montserrat island for a given set of input, selected to be the flow volume, initial flow direction, basal friction angle, and interval friction angle. The output concerned here are the maximum pyroclastic flow heights over time at each spatial grid. Since each run of the TITAN2D takes between 1 to 2 hours, the PP GaSP emulator was developed in (Gu and Berger 2016) to emulate the outputs from the TITAN2D. The data from the TITAN2D computer model can be found in https://github.com/MengyangGu/TITAN2D.
The following code will load the TITAN2D data in R:
R> library(repmis)
R> source_data("https://github.com/MengyangGu/TITAN2D/blob/master/TITAN2D.rda?raw=True")
[1] "input_variables" "pyroclastic_flow_heights"
[3] "loc_index"
> rownames(loc_index)
[1] "crater" "small_flow_area" "Belham_Valley"
The data contain three data frames. The input variables are a
We implement the PP GaSP emulator in the RobustGaSP package and test
on the TITAN2D data herein. We use the first
The following code will fit the PP GaSP emulator and make predictions on the Balham Valley area for each set of held out output.
R> input <- input_variables[1:50, ]
R> testing_input <- input_variables[51:683, ]
R> output <- pyroclastic_flow_heights[1:50, which(loc_index[3,]==1)]
R> testing_output <- pyroclastic_flow_heights[51:683, which(loc_index[3,]==1)]
R> n=dim(output)[1]
R> n_testing <- dim(testing_output)[1]
##delete those location where all output are zero
R> index_all_zero <- NULL
R> for(i_loc in 1: dim(output)[2]) {
+ if(sum(output[ ,i_loc]==0)==50) {
+ index_all_zero <- c(index_all_zero, i_loc)
+ }
+ }
##transforming the output
R> output_log_1 <- log(output+1)
R> m.ppgasp <- ppgasp(design=input[,1:3], response=as.matrix(output_log_1[ ,-index_all_zero]),
+ trend=cbind(rep(1, n),input[,1]), nugget.est=TRUE,max_eval=100, num_initial_values=3)
R> pred_ppgasp=predict.ppgasp(m.ppgasp, testing_input[ ,1:3],
+ testing_trend=cbind(rep(1, n_testing), testing_input[,1]))
R> m_pred_ppgasp_mean <- exp(pred_ppgasp$mean)-1
R> m_pred_ppgasp_LB <- exp(pred_ppgasp$lower95)-1
R> m_pred_ppgasp_UB <- exp(pred_ppgasp$upper95)-1
R> sqrt(mean(((m_pred_ppgasp_mean - testing_output_nonallzero)^2)))
[1] 0.2999377
In the above code, we fit the model using the transformed output and the first three inputs, as the fourth input (internal friction input) has almost no effect on the output. We also transform it back for prediction. As the fourth input is not used for emulation, we add a nugget to the model. The flow volume is included to be in the mean function, as the flow volume is positively correlated with the flow heights in all locations. These settings were used in (Gu and Berger 2016) for fitting the PP GaSP emulator to emulate the TITAN2D computer model. The only function we have not implemented in the current version of the RobustGaSP package is the “periodic folding" technique for the initial flow angle, which is a periodic input. This method will appear in a future version of the package.
Belham Valley | RMSE | Time (s) | ||
---|---|---|---|---|
Independent GaSP emulator | 0.30166 | 0.91100 | 0.52957 | 294.43 |
PP GaSP | 0.29994 | 0.93754 | 0.59474 | 4.4160 |
Non-crater area | RMSE | Time (s) | ||
Independent GaSP emulator | 0.33374 | 0.91407 | 0.53454 | 1402.04 |
PP GaSP | 0.32516 | 0.94855 | 0.60432 | 20.281 |
We compare the PP GaSP emulator with the independent GaSP emulator by
the DiceKriging package with the same choice of the kernel function,
mean function and transformation in the output. The PP GaSP emulator
performs slightly better in terms of the predictive RMSE and the data
covered in the
The biggest difference is the computational time for these examples. The
computational complexity by the independent GaSP emulator by the
DiceKriging package is
We have to acknowledge that, however, the PP GaSP emulator assumes the same covariance matrix across all output vector and estimate the kernel parameters using all output data. This assumption may not be satisfied in some applications. We do not believe that the PP GaSP emulator performs uniformly better than the independent GaSP emulator. Given the computational complexity and predictive accuracy shown in the two real examples discussed in this paper, the PP GaSP emulator can be used as a fast surrogate of a computer model with massive output.
Computer models are widely used in many applications in science and engineering. The Gaussian stochastic process emulator provides a fast surrogate for computationally intensive computer models. The difficulty of parameter estimation in the GaSP model is well-known, as there is no closed-form, well-behaved, estimator for the correlation parameters; and poor estimation of the correlation parameters can lead to seriously inferior predictions. The RobustGaSP package implements marginal posterior mode estimation of these parameters for parameterizations that satisfy the “robustness" criteria from (Gu et al. 2018). Part of the advantage of this method of estimation is that the posterior has zero density for the problematic cases in which the correlation matrix is an identity matrix or the matrix or all ones. Some frequently used estimators, such as the MLE, do not have this property. Several examples have been provided to illustrate the use of the RobustGaSP package. Results of out-of-sample prediction suggest that the estimators in RobustGaSP, with small to moderately large sample sizes, perform considerably better than the MLE.
Although the main purpose of the RobustGaSP package is to emulate
computationally intensive computer models, several functions could be
useful for other purposes. For example, the findInertInputs
function
utilizes the posterior modes to find inert inputs at no extra
computational cost than fitting the GaSP model. A noise term can be
added to the GaSP model, with fixed or estimated variance, allowing
RobustGaSP to analyze noisy data from either computer models or, say,
spatial experiments.
While posterior modes are used for estimating the correlation parameters
in the current software, it might be worthwhile to implement posterior
sampling for this Bayesian model. In GaSP models, the usual
computational bottleneck for such sampling is the evaluation of the
likelihood, as each evaluation requires inverting the covariance matrix,
which is a computation of order of
This research was supported by NSF grants DMS-1007773, DMS-1228317, EAR-1331353, and DMS-1407775. The research of Mengyang Gu was part of his PhD thesis at Duke University. The authors thank the editor and the referee for their comments that substantially improved the article.
DiceKriging, GPfit, mleGP, spatial, fields, RobustGaSP, lhs, sensitivity, nloptr
DifferentialEquations, Distributions, Environmetrics, ExperimentalDesign, Optimization, Spatial
This article is converted from a Legacy LaTeX article using the texor package. The pdf version is the official version. To report a problem with the html, refer to CONTRIBUTE on the R Journal homepage.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Gu, et al., "RobustGaSP: Robust Gaussian Stochastic Process Emulation in R", The R Journal, 2019
BibTeX citation
@article{RJ-2019-011, author = {Gu, Mengyang and Palomo, Jesús and Berger, James O.}, title = {RobustGaSP: Robust Gaussian Stochastic Process Emulation in R}, journal = {The R Journal}, year = {2019}, note = {https://rjournal.github.io/}, volume = {11}, issue = {1}, issn = {2073-4859}, pages = {112-136} }