pcSA-class: An S4 class to return the results of sensitivity analyses

Description Usage Arguments Value Methods (by generic) Slots References Examples

Description

An S4 class to return the results of sensitivity analyses

Show

Plots pcSA S4 object, a Partial Correlation Analysis of a Simulation Model

Usage

1
2
3
4
5
6
7
8
9
## S4 method for signature 'pcSA'
print(x, ...)

## S4 method for signature 'pcSA'
show(object)

## S4 method for signature 'pcSA'
plot(x, outcome_var = "Outcome", xlab = "Variable",
  ylab = "Standardized Rank Regression Coefficient")

Arguments

x

The result slot of an object created by pc_sa.

...

ignored @export

object

S4 pcSA object

@export

outcome_var

Optional character vector for labeling the outcome variable in the plot. Default is "Outcome".

xlab

Optional character vector for labeling the variables.

ylab

Optional character vector. Default is "Partial Rank Correlation Coefficient". Could also be "Partial Correlation Coefficient", "Standardized Rank Regression Coefficient", and "Standardized Regression Coefficient".

Value

Returns a ggplot2 plot.

Methods (by generic)

Slots

call

Language from the call of the function.

input_set

data.frame of input set used

sims

numeric vector with outcome of simulating model with input_set

result

c("src", "pcc") s3 classes from sensitivity package.

r_squared

Numeric vector length one.

rmse

Numeric vector length one.

timing

Numeric vector length one with the total elapsed time it took to execute.

session

the results from calling sessionInfo() at end of pc_sa function.

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).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)))
s <- pc_sa(fake_abm, inputs, "sq")
plot(s)

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