sobol_sa: Conduct a Sobol Sensitivity Analysis of a Simulation Model

Description Usage Arguments Details Value References Examples

Description

sobol_sa conducts a global variance decomposition.

Usage

1
2
3
4
sobol_sa(abm, input_values, out = "action_avg", sample_count = 100,
  constraints = "none", sobol_nboot = 1000, model_data = NULL,
  iterations = NULL, parallel = FALSE, cores = NULL, verbose = TRUE,
  extra_verbose = FALSE)

Arguments

abm

A function that takes as input values for each of the input_values

input_values

List

out

Optional Character vector length one to be passed an argument to the abm function to specify what outcome measure to use.

sample_count

Optional Numeric vector length one. Default is 100.

constraints

Optional Character vector that is either "none" or is using only variable names that are specified in the input_values List argument. This character vector is evaluated in an environment created for the sampled data on the variables, and its evaluation results in a Logical vector that that subsets sampled.

sobol_nboot

Optional Numeric vector length one. Default is 1000.

model_data

Optional data.frame with the data that was used to build the model. This is used if one wants to ensure that all parameters tested are in the convex hull of the data used to build the model that is now being analyzed. This uses the WhatIf package in the Suggest field of the eat description file.

iterations

Optional numeric vector length one.

parallel

Optional logical vector length one. Default is FALSE.

cores

Optional Numeric vector length one. Default is parallel::detectCores().

verbose

Optional logical vector.

extra_verbose

Optional logical vector, default is FALSE.

Details

This is function of the eat package. It takes an abm in function form and a list of input values.

Value

Returns an S4 object that can be plotted by its plot method.

References

J. C. Thiele, W. Kurth, V. Grimm, Facilitating Parameter Estimation and Sensitivity Analysis of Agent-Based Models: A Cookbook Using NetLogo and R. Journal of Artificial Societies and Social Simulation. 17, 11 (2014).

G. Pujol et al., Sensitivity: Sensitivity Analysis (2014), (available at http://cran.r-project.org/web/packages/sensitivity/index.html).

I.M. Sobol, S. Tarantola, D. Gatelli, S.S. Kucherenko and W. Mauntz, 2007, Estimating the approximation errors when fixing unessential factors in global sensitivity analysis, Reliability Engineering and System Safety, 92, 957-960.

A. Saltelli, P. Annoni, I. Azzini, F. Campolongo, M. Ratto and S. Tarantola, 2010, Variance based sensitivity analysis of model output. Design and estimator for the total sensitivity index, Computer Physics Communications 181, 259-270.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Unconstrained Analysis
fake_abm <- function(params, out) {
  x1 <- params[1]
  x2 <- params[2]
  if (out=="sq") return(x1^2 + x2 + rnorm(1, 0))
  if (out=="ident") return(x1 + x2 + rnorm(1, 0))
}
inputs <- lapply(list(param1 = NA, param2 = NA), 
                 function(x) list(random_function = "qunif",
                                  ARGS = list(min = 0, max = 1)))
sobol_sa(fake_abm, inputs, "sq")

# Constrained Analysis
fake_abm <- function(params, out) {
  x1 <- params[1]
  x2 <- params[2]
  if (out=="sq") return(x1^2 + x2 + rnorm(1, 0))
  if (out=="ident") return(x1 + x2 + rnorm(1, 0))
}
inputs <- lapply(list(param1 = NA, param2 = NA), 
                 function(x) list(random_function = "qunif",
                                  ARGS = list(min = 0, max = 1)))
sobol_sa(fake_abm, inputs, "sq", constraints = "param1 > 0.1 & param2 < 0.9")

JohnNay/sa documentation built on May 7, 2019, 12:01 p.m.