View source: R/reportSensitivityAnalysis.R
| subgroups | R Documentation |
subgroups: returns the table the effects per groups.
Code based on the sbgroups function written by Gilles Pujol for
the function sb in the sensitivity package.
subgroups(x)
x |
data |
data frame with group names and effects
require("SPOT")
require("RColorBrewer")
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 <- brewer.pal(12, "Set3")
barplot(ps$effect, names.arg=ps$group, col= colors)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.