Last data update: 2014.03.03

R: Plot a 3-D (using RGL) view of a kriging model, including...
sectionview3d.kmR Documentation

Plot a 3-D (using RGL) view of a kriging model, including design points

Description

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

  sectionview3d.km(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,
    ...)

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.

col_points

color of points.

col_surf

color for the surface.

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.

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.

bg_blend

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

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).

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.

title

an optional overload of main title.

add

to print graphics on an existing window.

...

further arguments passed to the first call of plot3d.

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'.

Note

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

Author(s)

Yann Richet, IRSN

See Also

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

m1 <- km(design = design.fact, response = y)

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

## 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")

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(DiceView)
Loading required package: DiceKriging
Loading required package: DiceEval
Loading required package: rgl
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DiceView/sectionview3d.km.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sectionview3d.km
> ### Title: Plot a 3-D (using RGL) view of a kriging model, including design
> ###   points
> ### Aliases: sectionview3d.km
> ### Keywords: models
> 
> ### ** 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
> 
> m1 <- km(design = design.fact, response = y)

optimisation start
------------------
* estimation method   : MLE 
* optimisation method : BFGS 
* analytical gradient : used
* trend model : ~1
* covariance model : 
  - type :  matern5_2 
  - nugget : NO
  - parameters lower bounds :  1e-10 1e-10 
  - parameters upper bounds :  2 2 
  - best initial criterion value(s) :  -82.95986 

N = 2, M = 5 machine precision = 2.22045e-16
At X0, 0 variables are exactly at the bounds
At iterate     0  f=        82.96  |proj g|=       1.0103
At iterate     1  f =       82.405  |proj g|=       0.89916
At iterate     2  f =       81.573  |proj g|=        1.3764
At iterate     3  f =       81.074  |proj g|=       0.74282
At iterate     4  f =       81.059  |proj g|=       0.23601
At iterate     5  f =       81.058  |proj g|=      0.017306
At iterate     6  f =       81.058  |proj g|=    0.00044838
At iterate     7  f =       81.058  |proj g|=    8.8395e-07

iterations 7
function evaluations 9
segments explored during Cauchy searches 8
BFGS updates skipped 0
active bounds at final generalized Cauchy point 1
norm of the final projected gradient 8.83952e-07
final function value 81.0576

F = 81.0576
final  value 81.057643 
converged
> 
> ## the same as sectionview3d.km
> sectionview3d(m1)
> 
> ## 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")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>