Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

km-methods

Plot a contour view of a kriging model, including design points


Description

Plot a contour view of a kriging model: mean response surface, fitted points and confidence surfaces. Provide a better understanding of the kriging model behaviour.

Plot one section view per dimension of a kriging model thus providing a better understanding of the model behaviour including uncertainty.

Plot a 3-D view of a kriging model: mean response surface, fitted points and confidence surfaces. Provide a better understanding of the kriging model behaviour.

Usage

## S3 method for class 'km'
contourview(
  model,
  type = "UK",
  center = NULL,
  axis = NULL,
  npoints = 20,
  nlevels = 10,
  col_points = "red",
  col_surf = "blue",
  filled = FALSE,
  bg_blend = 1,
  mfrow = NULL,
  Xname = NULL,
  yname = NULL,
  Xscale = 1,
  yscale = 1,
  xlim = NULL,
  ylim = NULL,
  title = NULL,
  add = FALSE,
  ...
)

## S3 method for class 'km'
sectionview(
  model,
  type = "UK",
  center = NULL,
  axis = NULL,
  npoints = 100,
  col_points = "red",
  col_surf = "blue",
  conf_lev = c(0.5, 0.8, 0.9, 0.95, 0.99),
  conf_blend = NULL,
  bg_blend = 5,
  mfrow = NULL,
  Xname = NULL,
  yname = NULL,
  Xscale = 1,
  yscale = 1,
  xlim = NULL,
  ylim = NULL,
  title = NULL,
  add = FALSE,
  ...
)

## S3 method for class 'km'
sectionview3d(
  model,
  type = "UK",
  center = NULL,
  axis = NULL,
  npoints = 20,
  col_points = "red",
  col_surf = "blue",
  col_needles = NA,
  conf_lev = c(0.95),
  conf_blend = NULL,
  bg_blend = 5,
  Xname = NULL,
  yname = NULL,
  Xscale = 1,
  yscale = 1,
  xlim = NULL,
  ylim = NULL,
  title = NULL,
  add = FALSE,
  ...
)

## S4 method for signature 'km'
sectionview(
  model,
  type = "UK",
  center = NULL,
  npoints = 100,
  col_points = "red",
  col_surf = "blue",
  conf_lev = c(0.5, 0.8, 0.9, 0.95, 0.99),
  conf_blend = NULL,
  bg_blend = 5,
  mfrow = NULL,
  Xname = NULL,
  yname = NULL,
  Xscale = 1,
  yscale = 1,
  xlim = NULL,
  ylim = NULL,
  title = NULL,
  ...
)

## S4 method for signature 'km'
sectionview3d(
  model,
  type = "UK",
  center = NULL,
  axis = NULL,
  npoints = 20,
  col_points = "red",
  col_surf = "blue",
  col_needles = NA,
  conf_lev = c(0.95),
  conf_blend = NULL,
  bg_blend = 5,
  Xname = NULL,
  yname = NULL,
  Xscale = 1,
  yscale = 1,
  xlim = NULL,
  ylim = NULL,
  title = NULL,
  ...
)

## S4 method for signature 'km'
contourview(
  model,
  type = "UK",
  center = NULL,
  axis = NULL,
  npoints = 20,
  col_points = "red",
  col_surf = "blue",
  bg_blend = 1,
  nlevels = 10,
  Xname = NULL,
  yname = NULL,
  Xscale = 1,
  yscale = 1,
  xlim = NULL,
  ylim = NULL,
  title = NULL,
  ...
)

Arguments

model

an object of class "km".

type

the kriging type to use for model prediction.

center

optional coordinates (as a list or data frame) of the center of the section view if the model's dimension is > 2.

axis

optional matrix of 2-axis combinations to plot, one by row. The value NULL leads to all possible combinations i.e. choose(D, 2).

npoints

an optional number of points to discretize plot of response surface and uncertainties.

nlevels

number of contour levels to display.

col_points

color of points.

col_surf

color for the surface.

filled

use filled.contour

bg_blend

an optional factor of alpha (color channel) blending used to plot design points outside from this section.

mfrow

an optional list to force par(mfrow = ...) call. The default value NULL is automatically set for compact view.

Xname

an optional list of string to overload names for X.

yname

an optional string to overload name for y.

Xscale

an optional factor to scale X.

yscale

an optional factor to scale y.

xlim

an optional list to force x range for all plots. The default value NULL is automatically set to include all design points.

ylim

an optional list to force y range for all plots. The default value NULL is automatically set to include all design points (and their 1-99 percentiles).

title

an optional overload of main title.

add

to print graphics on an existing window.

...

further arguments passed to the first call of plot3d.

conf_lev

an optional list of confidence interval values to display.

conf_blend

an optional factor of alpha (color channel) blending used to plot confidence intervals.

col_needles

color of "needles" for the points. The default NA corresponds to no needle plotted. When a valid color is given, needles are plotted using the same fading mechanism as for points.

km

kriging model

Details

Experimental points are plotted with fading colors. Points that fall in the specified section (if any) have the color specified col_points while points far away from the center have shaded versions of the same color. The amount of fading is determined using the Euclidean distance between the plotted point and center. The variables chosen with their number are to be found in the X slot of the model. Thus they are 'spatial dimensions' but not 'trend variables'.

A multiple rows/columns plot is produced. Experimental points are plotted with fading colors. Points that fall in the specified section (if any) have the color specified col_points while points far away from the center have shaded versions of the same color. The amount of fading is determined using the Euclidean distance between the plotted point and center.

Experimental points are plotted with fading colors. Points that fall in the specified section (if any) have the color specified col_points while points far away from the center have shaded versions of the same color. The amount of fading is determined using the Euclidean distance between the plotted point and center. The variables chosen with their number are to be found in the X slot of the model. Thus they are 'spatial dimensions' but not 'trend variables'.

Note

The confidence bands are computed using normal quantiles and the standard error given by predict.km.

The confidence bands are computed using normal quantiles and the standard error given by predict.km.

Author(s)

Yann Richet, IRSN

Yann Richet, IRSN

Yann Richet, IRSN

See Also

See sectionview3d.km and the km function in the DiceKriging package.

The function sectionview3d.km produces a 3D version. For more information on the km class, see the km function in the DiceKriging package.

See sectionview.km and the km function in the DiceKriging package.

Examples

## A 2D example - Branin-Hoo function. See DiceKriging package manual
## a 16-points factorial design, and the corresponding response
d <- 2; n <- 16
design.fact <- expand.grid(seq(0, 1, length = 4), seq(0, 1, length = 4))
design.fact <- data.frame(design.fact); names(design.fact)<-c("x1", "x2")
y <- branin(design.fact)

## kriging model 1 : matern5_2 covariance structure, no trend, no nugget effect
if (!exists("m1"))
m1 <- km(design = design.fact, response = y)

## the same as contourview.km
contourview(m1)

## change colors
contourview(m1, col_points = "firebrick", col_surf = "SpringGreen2")

## change colors,  use finer grid and add needles
contourview(m1, npoints = c(50, 30), col_points = "orange",
col_surf = "SpringGreen2")

## Display reference function
contourview(branin,dim=2,add=TRUE,col='red')
## A 2D example - Branin-Hoo function
## a 16-points factorial design, and the corresponding response
d <- 2; n <- 16
design.fact <- expand.grid(seq(0, 1, length = 4), seq(0, 1, length = 4))
design.fact <- data.frame(design.fact); names(design.fact)<-c("x1", "x2")
y <- branin(design.fact)

## kriging model 1 : matern5_2 covariance structure, no trend, no nugget effect
if (!exists("m1"))
m1 <- km(design = design.fact, response = y)

sectionview(m1, center = c(.333, .333))

## Display reference function
sectionview(branin,dim=2,center=c(.333, .333),add=TRUE,col='red')
## A 2D example - Branin-Hoo function. See DiceKriging package manual
## a 16-points factorial design, and the corresponding response
d <- 2; n <- 16
design.fact <- expand.grid(seq(0, 1, length = 4), seq(0, 1, length = 4))
design.fact <- data.frame(design.fact); names(design.fact)<-c("x1", "x2")
y <- branin(design.fact)

## kriging model 1 : matern5_2 covariance structure, no trend, no nugget effect
if (!exists("m1"))
m1 <- km(design = design.fact, response = y)

## the same as sectionview3d.km
sectionview3d(m1)

## Not run: 
## change colors
sectionview3d(m1, col_points = "firebrick", col_surf = "SpringGreen2")

## change colors,  use finer grid and add needles
sectionview3d(m1, npoints = c(50, 30), col_points = "orange",
  col_surf = "SpringGreen2", col_needles = "firebrick")

## End(Not run)

DiceView

Methods for Visualization of Computer Experiments Design and Surrogate

v2.0-1
GPL-3
Authors
Yann Richet, Yves Deville, Clement Chevalier
Initial release
2020-11-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.