SA_estimate {COINr} | R Documentation |
Post process a sample to obtain sensitivity indices. This function takes a univariate output
which is generated as a result of running a Monte Carlo sample from SA_sample()
through a system.
Then it estimates sensitivity indices using this sample.
SA_estimate(yy, N, d, Nboot = NULL)
yy |
A vector of model output values, as a result of a |
N |
The number of sample points per dimension. |
d |
The dimensionality of the sample |
Nboot |
Number of bootstrap draws for estimates of confidence intervals on sensitivity indices. If this is not specified, bootstrapping is not applied. |
This function is built to be used inside get_sensitivity()
.
A list with the output variance, plus a data frame of first order and total order sensitivity indices for
each variable, as well as bootstrapped confidence intervals if !is.null(Nboot)
.
get_sensitivity()
Perform global sensitivity or uncertainty analysis on a COIN
SA_sample()
Input design for estimating sensitivity indices
# This is a generic example rather than applied to a COIN (for reasons of speed)
# A simple test function
testfunc <- function(x){
x[1] + 2*x[2] + 3*x[3]
}
# First, generate a sample
X <- SA_sample(500, 3)
# Run sample through test function to get corresponding output for each row
y <- apply(X, 1, testfunc)
# Estimate sensitivity indices using sample
SAinds <- SA_estimate(y, N = 500, d = 3, Nboot = 1000)
SAinds$SensInd
# Notice that total order indices have narrower confidence intervals than first order.