Learn R Programming

propagate (version 1.0-4)

contribution: 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.

Value

A named vector with relative contributions for each variable and a barplot of the values, if plot = TRUE.

Details

$$C_i = \frac{\partial f}{\partial x_i}\sigma_i$$ with \(C_i\) = the "contribution", which is calculated by object$evalGrad * sqrt(diag(object$covMat)).

References

Expression of the Uncertainty of Measurement in Calibration. European Cooperation for Accreditation (EA-4/02), 1999.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab