Description Usage Arguments Details Value Examples
This is a generic function that can be used to estimate the sensitivity indices for complex computer models using GAM-based emulators.
1 | apsim_emul_sa(model, X, boot = 1000, conf = 0.95, y = NULL, method, ...)
|
model |
a function that specifies the model of interest |
X |
n-by-p matrix of input values; n runs, p inputs |
boot |
number of bootstrap replicates |
conf |
confidence level of bootstrap calibrated intervals |
y |
optional vector of model evaluations that can be used in place of the model statement |
method |
method to use to emulate the model; |
... |
additional arguments passed to |
Each column of the matrix X
corresponds to a different input and each row corresponds to a
different run of the computer model. Currently the method choices are: "singleGAM"
and
"separateGAM"
. The "singleGAM"
method builds a single generalized additive model (GAM)
with terms for all main
effects of inputs plus all two-way interactions between inputs. With this method all first-order
and total sensitivity indices are estimable provided at least 8p^2-4p+1 runs of the computer
model are available where p is the number of parameters included in the analysis.
The "separateGAM"
method builds a separate GAM emulator for each
input to estimate first-order indices for each input. Since this method emulates the marginal
distribution of y
given each of the inputs, total order indices cannot be computed. Both
methods can be bootstrapped in order to estimate standard errors and to calibrate confidence
regions for the sensitivity index estimates. The argument boot
specifies the number
of bootstrap replicates and conf
is the confidence level of the bootstrap calibrated
confidence region.
A data frame of sensitivity measures where the exact form depends on the method, see details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
meanYield<-function(x){
return(mean(x$lai_cowpea))
}
n <- 75
parValues <- data.frame(SoilCN = runif(n, 5, 25),
DiffusConst = runif(n, 20, 50), CNCov = runif(n, 0, 1))
apsimExe <-"C:/Program Files (x86)/Apsim75-r3008/Model/Apsim.exe"
apsimWd <- "~/APSIM"
apsimVars <- c("SoilOrganicMatter/SoilCN", "SoilWater/DiffusConst", "SoilWater/CNCov")
apsimFile <- "Canopy.apsim"
emulRes <- apsim_emul_sa(model = apsim_vector, X = parValues, method = "singleGAM",
exe = apsimExe, wd = apsimWd, vars = apsimVars, to.run = apsimFile,
g = meanYield, overwrite = TRUE)
emulRes
plot(emulRes)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.