SA_estimate: Estimate sensitivity indices

View source: R/sensitivity.R

SA_estimateR Documentation

Estimate sensitivity indices

Description

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.

Usage

SA_estimate(yy, N, d, Nboot = NULL)

Arguments

yy

A vector of model output values, as a result of a N(d+2) Monte Carlo design.

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.

Details

This function is built to be used inside get_sensitivity().

Value

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).

See Also

  • get_sensitivity() Perform global sensitivity or uncertainty analysis on a COIN

  • SA_sample() Input design for estimating sensitivity indices

Examples

# 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.


COINr documentation built on Oct. 9, 2023, 5:07 p.m.