Learn R Programming

SPOTMisc (version 1.19.52)

subgroups: Return effects for each subgroup

Description

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.

Usage

subgroups(x)

Value

data frame with group names and effects

Arguments

x

data

Examples

Run this code
# \donttest{
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)
# }

Run the code above in your browser using DataLab