## fit the Gaussian process ##
x1 = kronecker(seq(0,1,by=.25), rep(1,5))
x2 = rep(seq(0,1,by=.25),5)
z = 4 * x1 - 2*x2 + x1 * x2 + rnorm(length(x1), sd = 0.001)
fit = mlegp(cbind(x1,x2), z, param.names = c("x1", "x2"))
## plot the interaction effect ##
plotInteractionEffect(fit, effects = c(1,2))
## plot the interaction effect 'manually' ##
int = plotInteractionEffect(fit, effects = c(1,2), no.plot = TRUE)
contour(int$index1, int$index2, int$preds, xlab = "x1", ylab = "x2")Run the code above in your browser using DataLab