R: Contribution to propagated uncertainty for each variable
contribution
R Documentation
Contribution to propagated uncertainty for each variable
Description
Calculates the relative "contribution" C_i of each variable x_i to the propagated uncertainty, as defined in the Expression of the Uncertainty of Measurement in Calibration, Eqn 4.2, page 9 (see 'References'). In the implementation here, the contributions are rescaled to sum up to 1.
Usage
contribution(object, plot = TRUE, ...)
Arguments
object
an object obtained from propagate.
plot
logical. If TRUE, a barplot with the contributions is plotted.
...
other parameters for barplot.
Details
C_i = frac{partial f}{partial x_i}σ_i
with C_i = the "contribution", which is calculated by object$evalGrad * sqrt(diag(object$covMat)).
Value
A named vector with relative contributions for each variable and a barplot of the values, if plot = TRUE.
Author(s)
Andrej-Nikolai Spiess
References
Expression of the Uncertainty of Measurement in Calibration.
European Cooperation for Accreditation (EA-4/02), 1999.
Examples
EXPR1 <- expression(x^y)
x <- c(5, 0.2)
y <- c(1, 0.1)
DF1 <- cbind(x, y)
RES1 <- propagate(expr = EXPR1, data = DF1, type = "stat",
do.sim = TRUE, verbose = TRUE)
contribution(RES1)