C_tr {activegp} R Documentation

## Expected variance of trace of C

### Description

Expected variance of trace of C

### Arguments

 C A const_C object, the result of a call to C_GP. xnew The new design point grad If FALSE, calculate variance of trace after update. If TRUE, returns the gradient.

### Value

A real number giving the expected variance of the trace of C given the current design.

### References

N. Wycoff, M. Binois, S. Wild (2019+), Sequential Learning of Active Subspaces, preprint.

### Examples

################################################################################
### Variance of trace criterion landscape
################################################################################
library(hetGP)
set.seed(42)
nvar <- 2
n <- 20

# theta gives the subspace direction
f <- function(x, theta = pi/6, nugget = 1e-6){
if(is.null(dim(x))) x <- matrix(x, 1)
xact <- cos(theta) * x[,1] - sin(theta) * x[,2]
return(hetGP::f1d(xact) +
rnorm(n = nrow(x), sd = rep(nugget, nrow(x))))
}

design <- matrix(signif(runif(nvar*n), 2), ncol = nvar)
response <- apply(design, 1, f)
model <- mleHomGP(design, response, lower = rep(1e-4, nvar),
upper = rep(0.5,nvar), known = list(g = 1e-4))

C_hat <- C_GP(model)

ngrid <- 101
xgrid <- seq(0, 1,, ngrid)
Xgrid <- as.matrix(expand.grid(xgrid, xgrid))
filled.contour(matrix(f(Xgrid), ngrid))

Ctr_grid <- apply(Xgrid, 1, C_tr, C = C_hat)
filled.contour(matrix(Ctr_grid, ngrid), color.palette = terrain.colors,
plot.axes = {axis(1); axis(2); points(design, pch = 20)})

[Package activegp version 1.0.6 Index]