sens_apsimx {apsimx} | R 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,
soil.profiles,
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 |
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. |
soil.profiles |
list with soil profiles for replacement (see details.) |
summary |
function name to use to summarize the output to be a sinlge row (default is the mean). |
root |
root argument for |
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
It is possible to provide a list of soil profiles for replacement in the simulations. In this case, the parameter path can be simply ‘soil.profile’ or ‘soil_profile’ if there is one single simulation. It can also be the path to ‘Soil’. In this case, the path should be something such as ‘Simulations.SimulationName.Soil’. ‘SimulationName’ should be replaced with the appropriate string.
In the grid, the column with name ‘soil.profile’ should contain integers that will be used to pick from the list of provided soil profiles. In this case it is possible to re-use them. For example, the values could be 1, 2, 3, etc. to select the corresponding soil profiles from the ‘soil.profiles’ list.
If the ‘cores’ argument is greater than 1, then the package future is required. It will first search for a future plan under options and if nothing is found it will chose an OS-appropriate plan and it uses the chosen number of cores for execution.
Suggested reading on the topic of sensitivity analysis:
Pianosa et al (2016). Sensitivity analysis of environmental models: A systematic review with practical workflow. 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