plot.tgp: Plotting for Treed Gaussian Process Models

plot.tgpR Documentation

Plotting for Treed Gaussian Process Models

Description

A generic function for plotting of "tgp"-class objects. 1-d posterior mean and error plots, 2-d posterior mean and error image and perspective plots, and 3+-dimensional mean and error image and perspective plots are supported via projection and slicing.

Usage

## S3 method for class 'tgp'
plot(x, pparts = TRUE, proj = NULL, slice = NULL,
         map = NULL, as = NULL, center = "mean", layout = "both",
         main = NULL, xlab = NULL, ylab = NULL, zlab = NULL, pc = "pc",
         gridlen = c(40,40), span = 0.1, pXX = TRUE,
         legendloc = "topright", maineff = TRUE,  mrlayout="both",
         rankmax = 20, ...)

Arguments

x

"tgp"-class object that is the output of one of the b* functions: blm, btlm bgp, bgpllm, btgp, or btgpllm

pparts

If TRUE, partition-regions are plotted (default), otherwise they are not

proj

1-or-2-Vector describing the dimensions to be shown in a projection. The argument is ignored for 1-d data, i.e., if x$d == 1. For 2-d data, no projection needs be specified— the default argument (proj = NULL) will result in a 2-d perspective or image plot. 1-d projections of 2-d or higher data are are supported, e.g., proj = c(2) would show the second variable projection. For 3-d data or higher, proj=NULL defaults to proj = c(1,2) which plots a 2-d projection for the first two variables. Slices have priority over the projections— see next argument (slice)— when non-null arguments are provided for both.

slice

list object with x and z fields, which are vectors of equal length describing the slice to be plotted, i.e., which z-values of the x$d - 2 inputs x$X and x$XX should be fixed to in order to obtain a 2-d visualization. For example, for 4-d data, slice = list(x=(2,4), z=c(0.2, 1.5) will result in a 2-d plot of the first and third dimensions which have the second and fourth slice fixed at 0.5 and 1.5. The default is NULL, yielding to the proj argument. Argument is ignored for 1-d data, i.e., if x$d == 1

map

Optional 2-d map (longitude and latitude) from maps to be shown on top of image plots

center

Default center = "mean" causes the posterior predictive mean to be plotted as the centering statistic. Otherwise the median can be used with center = "med", or the kriging mean with center = "km"

as

Optional string indicator for plotting of adaptive sampling statistics: specifying as = "alm" for ALM, as = "s2" for predictive variance, as = "ks2" for expected kriging variance, as = "alc" for ALC, and as = "improv" for expected improvement (about the minimum, see the rankmax argument below). The default as = NULL plots error-bars (1d-plots) or error magnitudes (2d-plots), which is essentially the same as as = "alm"

layout

Specify whether to plot the mean predictive surface (layout = "surf"), the error or adaptive sampling statistics (layout = "as"), or default (layout = "both") which shows both. If layout = "sens", plot the results of a sensitivity analysis (see sens) in a format determined by the argument maineff below.

main

Optional character string to add to the main title of the plot

xlab

Optional character string to add to the x label of the plots

ylab

Optional character string to add to the y label of the plots

zlab

Optional character string to add to the z label of the plots; ignored unless pc = "p"

pc

Selects perspective-posterior mean and image-error plots (pc = "pc", the default) or a double–image plot (pc = "c")

(only valid for 2-d plots)

gridlen

Number of regular grid points for 2-d slices and projections in x and y. The default of gridlen = c(40,40) causes a 40 * 40 grid of X, Y, and Z values to be computed. Ignored for 1-d plots and projections

span

Span for loess kernel. The tgp package default (span = 0.1) is set lower than the loess default. Smaller spans can lead to warnings from loess when the data or predictive locations are sparse and ugly plots may result. In this case, try increasing the span

pXX

scalar logical indicating if XX locations should be plotted

legendloc

Location of the legend included in the plots of sensitivity analyses produced with layout = "sens", or 1-d plots of multi-resolution models (with corr = "mrexpsep") and option mrlayout = "both"; otherwise the argument is ignored

maineff

Format for the plots of sensitivity analyses produced with layout = "sens"; otherwise the argument is ignored. If maineff=TRUE main effect plots are produced alongside boxplots for posterior samples of the sensitivity indices, and if FALSE only the boxplots are produced. Alternatively, maineff can be a matrix containing input dimensions in the configuration that the corresponding main effects are to be plotted; that is, mfrow=dim(maineff). In this case, a 90 percent interval is plotted with each main effect and the sensitivity index boxplots are not plotted.

mrlayout

The plot layout for double resolution tgp objects with params$corr == "mrexpsep". For the default mrlayout="both", the coarse and fine fidelity are plotted together, either on the same plot for 1D inputs or through side-by-side image plots of the predicted center with axis determined by proj for inputs of greater dimension. Note that many of the standard arguments – such as slice, pc, and map – are either non-applicable or unsupported for mrlayout="both". If mrlayout="coarse" or mrlayout="fine", prediction for the respective fidelity is plotted as usual and all of the standard options apply.

rankmax

When as = "improv" is provided, the posterior expected improvements are plotted according the the first column of the improv field of the "tgp"-class object. Text is added to the plot near the XX positions of the first 1:rankmax predictive locations with the highest ranks in the second column of the improv field.

...

Extra arguments to 1-d (plot) and 2-d plotting functions persp and image

Value

The only output of this function is beautiful plots

Note

This plotting function is provided with the intention that it will be used as an aid in the visualization of "tgp"-class objects. Users are encouraged to use the source code for this function in order to develop custom plotting functions.

1-d projections for 3-d or higher data are also available by specifying a 1-d projection argument (e.g. proj=c(1) for projecting onto the first input variable).

For examples, see vignette("tgp") and the help files of those functions in "See Also", below

Author(s)

Robert B. Gramacy, rbg@vt.edu, and Matt Taddy, mataddy@amazon.com

References

https://bobby.gramacy.com/r_packages/tgp/

See Also

plot, bgpllm, btlm, blm, bgp, btgpllm, predict.tgp, tgp.trees, mapT, loess, sens


tgp documentation built on Jan. 7, 2023, 1:17 a.m.