sensitive_stics: Make sensitivity analysis of STICS output

Description Usage Arguments Details Value See Also Examples

View source: R/sensitive_stics.R

Description

Make sensitivity analysis on a particular output(s) given STICS input parameter(s) and their intercation if several are given.

Usage

1
2
3
sensitive_stics(dir.orig, dir.targ = getwd(), stics, obs_name, Parameters,
  Vars, method = c("fast99", "sobol"), n = 10 * length(Vars), q = "qunif",
  Plant = 1, Erase = T, ...)

Arguments

dir.orig

Path to the directory from which to copy the simulation files. If NULL (the default), uses the package dummy USM.

dir.targ

Path to the target directory for evaluation. Created if missing.

stics

STICS executable path

obs_name

A vector of observation file name(s). It must have the form c(Dominant,Dominated) for mixed crops. See read_obs filename parameter for more details.

Parameters

A list of list of min and max values for each parameters, named after them (see details and example)

Vars

Output variables on which the sensitivity is performed

method

The sensitivity method to use, see sensitivity package

n

Sample size for simulation (must be an even number for 'sobol' alike methods)

q

A vector of quantile function names corresponding to factors distribution (see fast99 and details)

Plant

The plant (i.e. Principal or associated) for which the parameters will be set (only for plant or technical parameters in mixed crop simulations) Set to NULL if using STICS in sole crop

Erase

Should the simulations data be erased upon import ? (see details)

...

Further parameters passed to the sensitivity function called (see sensitivity package)

Details

The function uses the sensitivity package functions under the hood to create the DOE (design of experiment) and then to compute the sensitivity index. For 'sobol' alike methods, the DOE is first computed using the fast99 function using the 'q' and 'Parameters' (for 'q.arg') parameters. The DOE is then splitted in two to fill the 'X1“ and 'X2' parameters. The 'Parameters' should take the form of a list of arguments to pass to the 'q' function for each parameter, named after the parameter of interest (see example). As the simulations can take a lot of space on disk while augmenting the parameters number, the 'Erase' parameter allow the user to erase each simulation as soon as its data is imported.

Value

A list of three :

See Also

Distributions if you use fast99.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
library(sticRs)
# Example using the fast99 method for a sensitivity analysis on the
# "interrang" and "P_densitesem" parameters:

sensitive_stics(dir.orig = "0-DATA/dummy/SC_Wheat",
                dir.targ = "2-Simulations/Sensitivity2",
                stics = "0-DATA/stics_executable/EquDens_trg/stics.exe",
                obs_name = "Wheat_N0.obs",
                Parameters= list(interrang= list(min=0.05, max=0.25),
                                 P_densitesem= list(min=140, max=280)),
                Vars = c("raint", "lai(n)", "masec(n)"),
                method= "fast99", n= 10, q= "qunif")

# Example using the sobol method for a sensitivity analysis on the
# "interrang" and "P_densitesem" parameters with different quantile functions:

sensitive_stics(dir.orig = "0-DATA/dummy/SC_Wheat",
                dir.targ = "2-Simulations/Sensitivity2",
                stics = "0-DATA/stics_executable/EquDens_trg/stics.exe",
                obs_name = "Wheat_N0.obs",
                Parameters= list(interrang= list(min=0.05, max=0.25),
                                 P_densitesem= list(mean=210, sd=30)),
                Vars = c("raint", "lai(n)", "masec(n)"),
                method= "fast99", n= 10,
                q= c("qunif","qnorm"))

## End(Not run)

VEZY/sticRs documentation built on Oct. 1, 2018, 1:06 p.m.