# NOT RUN {
set.seed(2)
# Interesting for larger n:
n <- 2
lower <- c(-0.1, rep(-10,n))
upper <- c(0.1, rep(10,n))
# Model-based optimization
res <- spot(,funSphere,
lower, upper,
control=list(funEvals=30,
optimizer = optimNLOPTR))
# Use the surrogate model for prediction
predictFunKriging <- function(x){
predict(object = res$modelFit, x)
}
# Determine sensitivity
sens <- sequentialBifurcation(predictFunKriging,
lower, upper,
k=n+1, interaction = TRUE, verbosity = 0)
# Extract group information (variable effects) from sensitivity analysis
ps <- subgroups(sens)
colors <- RColorBrewer::brewer.pal(12, "Set3")
barplot(ps$effect, names.arg=ps$group, col= colors)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab