sens_apsimx: Sensitivity Analysis for APSIM Next Generation simulation

View source: R/sens_apsimx.R

sens_apsimxR Documentation

Sensitivity Analysis for APSIM Next Generation simulation

Description

It is a wrapper for running APSIM-X and evaluating different parameters values

Summary computes variance-based sensitivity indexes from an object of class ‘sens_apsim’

Usage

sens_apsimx(
  file,
  src.dir = ".",
  parm.paths,
  convert,
  replacement,
  grid,
  summary = c("mean", "max", "var", "sd", "none"),
  root,
  verbose = TRUE,
  cores = 1L,
  save = FALSE,
  ...
)

## S3 method for class 'sens_apsim'
summary(object, ..., scale = FALSE, select = "all", warning = TRUE)

Arguments

file

file name to be run (the extension .apsimx is optional)

src.dir

directory containing the .apsimx file to be run (defaults to the current directory)

parm.paths

absolute or relative paths of the coefficients to be evaluated. It is recommended that you use inspect_apsimx for this

convert

(logical) This argument is needed if there is a need to pass a vector instead of a single value. The vector can be passed as a character string (separated by spaces) and it will be converted to a numeric vector. It should be either TRUE or FALSE for each parameter.

replacement

TRUE or FALSE for each parameter. Indicating whether it is part of the ‘replacement’ component. Its length should be equal to the length or ‘parm.paths’.

grid

grid of parameter values for the evaluation. It can be a data.frame.

summary

function name to use to summarize the output to be a sinlge row (default is the mean).

root

root argument for edit_apsimx_replacement

verbose

whether to print progress in percent and elapsed time.

cores

number of cores to use for parallel evaluation

save

whether to save intermediate results. By default they will be saved as a ‘csv’ file using the name of the apsim file. This will replace ‘apsimx’ with ‘csv’. It is also possible to provide the file name here (for example: ‘Some_results.csv’).

...

additional arguments (none used at the moment)

object

object of class ‘sens_apsim’

scale

if all inputs are numeric it is better to scale them. The default is FALSE as some inputs might be characters or factors. In this case all inputs will be treated as factors in the sum of squares decomposition.

select

option for selecting specific variables in the APSIM output. It will be treated as a regular expression

warning

whether to issue a warning when applying this function to an object which has not been summarized

Details

Suggested reading on the topic of sensitivity analysis:

Pianosa et al (2016). Sensitivity analysis of environmental models: A systematic review with practical workflow. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.envsoft.2016.02.008")}

Saltelli et al. . Global Sensitivity Analysis.

Value

object of class ‘sens_apsim’, but really just a list with results from the evaluations.

prints to console

Note

The summary function is stored as an attribute of the data frame ‘grid.sims’.

Examples


## See the vignette for examples



femiguez/apsimx documentation built on April 13, 2024, 12:04 a.m.