plot.tgp {tgp}R 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

plot.tgp(x, pparts = TRUE, proj = NULL, slice = NULL, map = NULL,
         as = NULL, layout = "both", main = NULL, xlab = NULL,
         ylab = NULL, zlab = NULL, pc = "pc", method = "loess",
         gridlen = 40, span = 0.1, ...)

Arguments

x "tgp" class object that is the output of one of the tgp 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 projectsions— 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 library(maps) to be shown on top of image plots
as Optional string indicator for plotting of adaptive sampling statistics: specifying as = "alm" for ALM, as = "alc" for ALC, and as = "ego" for EGO. 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
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")
method Method of interpolation onto a regular grid for perspective and image plotting of 2-d slices and projections. Ignored for 1-d plots and projections. Default is method = "loess" which results in the use of the built-in loess function via the provided interp.loess interface. The lowess kernel span can be specified with the span parameter to this function. Another option, method = "akima" uses the akima function interp.old. In general, akima provides a better (linear) interpolation, but the current version(s) has been buggy (see notes below), and so is not the default
gridlen Number of regular grid points for 2-d slices and projections. Default is gridlen = 40. Ignored for 1-d plots and projections
span Span for loess kernel. See help(loess) for mode details. This argument is ignored for 1-d plots and projections, and 2-d plots with method = "akima". The tgp package default (span = 0.1) is set lower than the loess default. Decreasing the span any further, or when the data or predictive locations are sparse, warnings may be given and ugly plots may result. In this case, try increasing the span, or use the method = "akima" option
... 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.

There seems to be two bugs in the interp function of the akima package. The first, benign, bug causes NAs to appear when plotting 2-d surfaces. The result is white rectangles (or “holes”) in the surfaces. This affect is most severe when x$X and x$XX together form a regular grid, or close to a regular grid. The second, malign, bug can cause segmentation faults when plotting projections, causing the entire R session to crash. Please note this is not a bug in the tgp package, rather it is a bug in the akima package. Instead, interpolation by the loess function is provided as a workaround, and is the default (method = "loess"). 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 rbgramacy@ams.ucsc.edu

References

http://www.ams.ucsc.edu/~rbgramacy/tgp.html

See Also

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


[Package tgp version 1.1-11 Index]