# print_uncertainty_2d: Prints a measure of uncertainty for 2d function. In KrigInv: Kriging-Based Inversion for Deterministic and Noisy Computer Experiments

## Description

This function draws the value of a given measure of uncertainty over the whole input domain (2D). The function can be used to print relevant outputs after having used the function `EGI` or `EGIparallel`.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10``` ```print_uncertainty_2d(model, T, type = "pn", lower = c(0, 0), upper = c(1, 1), resolution = 200, new.points = 0, xscale = c(0, 1), yscale = c(0, 1), show.points = TRUE, cex.contourlab = 1, cex.points = 1, cex.axis = 1, pch.points.init = 17, pch.points.end = 17, col.points.init = "black", col.points.end = "red", nlevels = 10, levels = NULL, xaxislab = NULL, yaxislab = NULL, xaxispoint = NULL, yaxispoint = NULL, krigmeanplot=FALSE,vorobmean=FALSE,consQuantile=NULL,...) ```

## Arguments

 `model` Kriging model of `km` class. `T` Array containing one or several thresholds. `type` Type of uncertainty that the user wants to print. Possible values are `"pn"` (probability of excursion), or `"sur"`, `"imse"`, `"timse"`, `"vorob"` if we print a measure of uncertainty corresponding to one criterion. `lower` Vector containing the lower bounds of the input domain. `upper` Vector containing the upper bounds of the input domain. `resolution` Number of points to discretize the domain. This discretization is used in each dimension, so that the total number of points is `resolution^2`. `new.points` Number of new observations. These observations are the last new.points observations and can be printed in another color and the initial observations (see argument: `col.points.end`). `xscale` If one wants to rescale the input domain on another interval it is possible to set this vector of size 2. The new interval will be translated by `xscale` and expanded by a factor `xscale - xscale`. `yscale` see: `xscale`. `show.points` Boolean: should we show the observations on the graph ? `cex.contourlab` Multiplicative factor for the size of labels of the contour plot. `cex.points` Multiplicative factor for the size of the points. `cex.axis` Multiplicative factor for the size of the axis graduations. `pch.points.init` Symbol for the `n-new.points` first observations. `pch.points.end` Symbol for the `new.points` last observations. `col.points.init` Color for the `n-new.points` first observations. `col.points.end` Color for the `new.points` last observations. `nlevels` Integer corresponding to the number of levels of the contour plot. `levels` Array: one can directly set the levels of the contour plot. `xaxislab` Optional new labels that will replace the normal levels on x axis. `yaxislab` Optional new labels that will replace the normal levels on y axis. `xaxispoint` Position of these new labels on x axis. `yaxispoint` Position of these new labels on y axis. `krigmeanplot` Optional boolean. When it is set to `FALSE` (default) the contour plot corresponds to the uncertainty selected. When it is set to `TRUE` the contour plot gives the kriging mean. `vorobmean` Optional boolean. When it is set to `TRUE` the Vorob'ev expectation is plotted. It corresponds to the averaged excursion set, using the definition of Vorob'ev. `consQuantile` Optional value for plotting conservative quantiles. In order to plot Conservative estimates: `consQuantile` is a list containing at least `consLevel` (scalar), with the option `typeEx` (character, default = ">"). Generic Vorob'ev quantiles: `consQuantile` is a scalar corresponding to the Vorob'ev quantile level. `...` Additional arguments to the `image` function.

## Value

The integrated uncertainty. If the conservative estimate is computed, it also returns the conservative quantile level.

## Author(s)

Clement Chevalier (University of Neuchatel, Switzerland)

Dario Azzimonti (IDSIA, Switzerland)

## References

Bect J., Ginsbourger D., Li L., Picheny V., Vazquez E. (2012), Sequential design of computer experiments for the estimation of a probability of failure, Statistics and Computing vol. 22(3), pp 773-793

`print_uncertainty_1d`,`print_uncertainty_nd`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40``` ```#print_uncertainty_2d set.seed(9) N <- 20 #number of observations T <- c(20,40) #thresholds testfun <- branin lower <- c(0,0) upper <- c(1,1) #a 20 points initial design design <- data.frame( matrix(runif(2*N),ncol=2) ) response <- testfun(design) #km object with matern3_2 covariance #params estimated by ML from the observations model <- km(formula=~., design = design, response = response,covtype="matern3_2") ## Not run: print_uncertainty_2d(model=model,T=T,main="probability of excursion", type="pn",krigmeanplot=TRUE,vorobmean=TRUE) #print_uncertainty_2d(model=model,T=T,main="vorob uncertainty", #type="vorob",krigmeanplot=FALSE) #print_uncertainty_2d(model=model,T=T,main="imse uncertainty", #type="imse",krigmeanplot=FALSE) #print_uncertainty_2d(model=model,T=T,main="timse uncertainty", #type="timse",krigmeanplot=FALSE) ## Print uncertainty 2d and conservative estimate at level 0.95 # uq2d<- print_uncertainty_2d(model=model,T=T,main="probability of excursion", # type="pn",krigmeanplot=TRUE,vorobmean=FALSE, # consQuantile=list(consLevel=0.95)) # print_uncertainty_2d(model=model,T=T,main="probability of excursion", # type="pn",krigmeanplot=TRUE,vorobmean=FALSE, # consQuantile=uq2d) ## End(Not run) ```