the number of iterations for use in prediction. See predict.GP
range
the input range for plotting (default set to [0, 1])
resolution
the number of points along a coordinate in the specified range
For 1 Dimensional Plotting
colors
a vector of length 3 assigning colors[1] to training design points,
colors[2] to model predictions, and colors[3] to the error bounds
line_type
a vector of length 2 assigning line_type[1] to model predictions,
and line_type[2] to the error bounds
pch
a parameter defining the plotting character for
the training design points, see ‘pch’ for possible options in par
cex
a parameter defining the size of the pch used
for plotting the training design points, see ‘cex’ for possible options in par
legends
a parameter that controls the inclusion of a legend; by default it is ‘FALSE’
For 2 Dimensional Plotting
surf_check
logical, switch between 3d surface and 2d level/contour plotting,
the default of FALSE implies level/contour plotting
response
logical, switch between predicted response and error (MSE) plots, the default
of TRUE displays the response surface
...
additional arguments from wireframe or levelplot
Author(s)
Blake MacDonald, Hugh Chipman, Pritam Ranjan
References
Ranjan, P., Haynes, R., and Karsten, R. (2011). A Computationally Stable
Approach to Gaussian Process Interpolation of Deterministic Computer Simulation Data,
Technometrics, 53(4), 366 - 378.
See Also
GP_fit for estimating the parameters of the GP model; predict.GP for predicting the response and error surfaces; par for additional plotting characters and line types for 1 dimensional plots; wireframe and levelplot for additional plotting settings in 2 dimensions.
Examples
## 1D Example 1
n = 5; d = 1;
computer_simulator <- function(x){
x = 2*x+0.5;
y = sin(10*pi*x)/(2*x) + (x-1)^4;
return(y)
}
set.seed(3);
library(lhs);
x = maximinLHS(n,d);
y = computer_simulator(x);
GPmodel = GP_fit(x,y);
plot.GP(GPmodel)
## 1D Example 2
n = 7; d = 1;
computer_simulator <- function(x) {
y = log(x+0.1)+sin(5*pi*x);
return(y)
}
set.seed(1);
library(lhs);
x = maximinLHS(n,d);
y = computer_simulator(x);
GPmodel = GP_fit(x,y);
## Plotting with changes from the default line type and characters
plot.GP(GPmodel, resolution = 100, line_type = c(6,2), pch = 5)
## 2D Example: GoldPrice Function
computer_simulator <- function(x) {
x1=4*x[,1] - 2; x2=4*x[,2] - 2;
t1 = 1 + (x1 + x2 + 1)^2*(19 - 14*x1 + 3*x1^2 - 14*x2 +
6*x1*x2 + 3*x2^2);
t2 = 30 + (2*x1 -3*x2)^2*(18 - 32*x1 + 12*x1^2 + 48*x2 -
36*x1*x2 + 27*x2^2);
y = t1*t2;
return(y)
}
n = 30; d = 2;
set.seed(1);
library(lhs);
library(lattice);
x = maximinLHS(n,d);
y = computer_simulator(x);
GPmodel = GP_fit(x,y);
## Basic level plot
plot.GP(GPmodel)
## Adding Contours and increasing the number of levels
plot.GP(GPmodel, contour = TRUE, cuts = 50, pretty = TRUE)
## Plotting the Response Surface
plot.GP(GPmodel, surf_check = TRUE)
## Plotting the Error Surface with color
plot.GP(GPmodel, surf_check = TRUE, response = FALSE, shade = TRUE)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GPfit)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GPfit/plot.GP.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot.GP
> ### Title: Plotting GP model fits
> ### Aliases: plot.GP
>
> ### ** Examples
>
> ## 1D Example 1
> n = 5; d = 1;
> computer_simulator <- function(x){
+ x = 2*x+0.5;
+ y = sin(10*pi*x)/(2*x) + (x-1)^4;
+ return(y)
+ }
> set.seed(3);
> library(lhs);
> x = maximinLHS(n,d);
> y = computer_simulator(x);
> GPmodel = GP_fit(x,y);
> plot.GP(GPmodel)
>
>
> ## 1D Example 2
> n = 7; d = 1;
> computer_simulator <- function(x) {
+ y = log(x+0.1)+sin(5*pi*x);
+ return(y)
+ }
> set.seed(1);
> library(lhs);
> x = maximinLHS(n,d);
> y = computer_simulator(x);
> GPmodel = GP_fit(x,y);
> ## Plotting with changes from the default line type and characters
> plot.GP(GPmodel, resolution = 100, line_type = c(6,2), pch = 5)
>
>
> ## 2D Example: GoldPrice Function
> computer_simulator <- function(x) {
+ x1=4*x[,1] - 2; x2=4*x[,2] - 2;
+ t1 = 1 + (x1 + x2 + 1)^2*(19 - 14*x1 + 3*x1^2 - 14*x2 +
+ 6*x1*x2 + 3*x2^2);
+ t2 = 30 + (2*x1 -3*x2)^2*(18 - 32*x1 + 12*x1^2 + 48*x2 -
+ 36*x1*x2 + 27*x2^2);
+ y = t1*t2;
+ return(y)
+ }
> n = 30; d = 2;
> set.seed(1);
> library(lhs);
> library(lattice);
> x = maximinLHS(n,d);
> y = computer_simulator(x);
> GPmodel = GP_fit(x,y);
> ## Basic level plot
> plot.GP(GPmodel)
> ## Adding Contours and increasing the number of levels
> plot.GP(GPmodel, contour = TRUE, cuts = 50, pretty = TRUE)
> ## Plotting the Response Surface
> plot.GP(GPmodel, surf_check = TRUE)
> ## Plotting the Error Surface with color
> plot.GP(GPmodel, surf_check = TRUE, response = FALSE, shade = TRUE)
>
>
>
>
>
> dev.off()
null device
1
>