Learn R Programming

propagate (version 1.0-6)

stochContr: Stochastic contribution analysis of Monte Carlo simulation-derived propagated uncertainty

Description

Conducts a "stochastic contribution analysis" by calculating the change in propagated uncertainty when each of the simulated variables is kept constant at its mean, i.e. the uncertainty is removed.

Usage

stochContr(prop, plot = TRUE)

Arguments

prop

a propagate object.

plot

logical. If TRUE, a boxplot with the original and mean-value propagated distribution.

Value

The relative contribution \(C_i\) for all variables.

Details

This function takes the Monte Carlo simulated data \(X_n\) from a propagate object (...$datSIM), sequentially substitutes each variable \(\beta_i\) by its mean \(\bar{\beta_i}\) and then re-evaluates the output distribution \(Y_n = f(\beta, X_n)\). Optional boxplots are displayed that compare the original \(Y_n\mathrm{(orig)}\) to those obtained from removing \(\sigma\) from each \(\beta_i\). Finally, the relative contribution \(C_i\) for all \(\beta_i\) is calculated by \(C_i = \sigma(Y_n\mathrm{(orig)})-\sigma(Y_n)\), and divided by its sum so that \(\sum_{i=1}^n C_i = 1\).

Examples

Run this code
# NOT RUN {
a <- c(15, 1)
b <- c(100, 5)
c <- c(0.5, 0.02)
DAT <- cbind(a, b, c)
EXPR <- expression(a * b^sin(c))
RES <- propagate(EXPR, DAT, nsim = 100000)
stochContr(RES)
# }

Run the code above in your browser using DataLab