nl_get_fast_sensitivity R Documentation

Calculate sensitivity according to the FAST algorithm

Description

Uses sensitivity from fast package to calculate a series of model outputs according to the FAST alogrithm

Usage

nl_get_fast_sensitivity(result, criteria)

Arguments

result

A nlexperiment result object

criteria

Name of evaluation criteria

Details

Only works when parameter value sets are defined with nl_param_fast function. Criteria must be defined in experiment (see nl_experiment, eval_criteria argument). Sensitivity is callculated for every simulation iteration (run_id).

Value

A data frame with sensitivity from simulation results for every simulation repetition (run_id)

Examples

## Not run: 

experiment <- nl_experiment(
  model_file = "models/Sample Models/Biology/Flocking.nlogo",
  setup_commands = c("setup", "repeat 100 [go]"),
  iterations = 5,

  param_values = nl_param_fast(
    world_size = 50,
    population = 80,
    max_align_turn = c(1, 5, 20),
    max_cohere_turn = c(1, 3, 20),
    max_separate_turn = c(1, 1.5, 20),
    vision = c(1, 3, 10),
    minimum_separation = c(1, 3, 10)
  ),
  mapping = c(
    max_align_turn = "max-align-turn",
    max_cohere_turn = "max-cohere-turn",
    max_separate_turn = "max-separate-turn",
    minimum_separation = "minimum-separation",
    world_size = "world-size",
  ),
  step_measures = measures(
    converged = "1 -
      (standard-deviation [dx] of turtles +
       standard-deviation [dy] of turtles) / 2",
    mean_crowding =
      "mean [count flockmates + 1] of turtles"
  ),
  eval_criteria = criteria(                # aggregate over iterations
    c_converged = mean(step$converged),
    c_mcrowding = mean(step$mean_crowding)
  ),

  repetitions = 10,                        # repeat simulations 10 times
  random_seed = 1:10
)

#run experiment
result <- nl_run(experiment, parallel = TRUE)

#get sensitivity data
sensitivity_data <- nl_get_fast_sensitivity(result, "c_converged")

## End(Not run)