## Error propagation in R: Monte Carlo simulations using copulas

Physicists and engineers often have to calculate the uncertainty in a derived quantity.

For instance, a test engineer repeatedly measures two separate angles. The uncertainty (or error) in the measurements of each of these angles appears to be +/- 1 degree. Subsequently, the engineer calculates the sum of these two angles. This sum is a derived quantity. But note that this derived quantity is composed of two measured quantities each having their own uncertainties, so what is the uncertainty (or error) in this derived quantity? In other words, how propagates the uncertainty from the measured quantities (the two angles) to a derived quantity (sum of two angles).

The following R code calculates the uncertainty in a derived quantity using a Monte Carlo simulation. Moreover, the Monte Carlo simulation employs copulas that fall into the Archimedean class of copulas. This class consists of members such as the Clayton and Gumbel copula. These Archimedean copulas make it possible to calculate the uncertainty in a derived quantity when 1) the measured quantities are dependent (correlated), and 2) the measured quantities follow a normal or some asymmetric distribution (e.g., an exponential, lognormal, or Weibull distribution).

R code that uses a Gaussian copula for calculating the uncertainty in a derived quantity can be found in this blog post.

## Error propagation in R: addition in quadrature versus the bootstrap method

Physicists and engineers often have to calculate the uncertainty in a derived quantity.

For instance, a test engineer measures two angles. The uncertainty (or error) in these measurements appears to be +/- 1 degree. Subsequently, the engineer calculates the sum of these two angles. This sum is a derived quantity. But note that this derived quantity is composed of two measurements each having their own uncertainties, so what is the uncertainty (or error) in this derived quantity? In other words, how propagates the uncertainty from the measured quantities (the two angles) to a derived quantity (sum of two angles). For calculating the uncertainty in this derived quantity, physicists and engineers rely on what is called the addition in quadrature procedure.

The addition in quadrature procedure provides an estimate of the Standard Deviation Of the Mean (SDOM), which is a quantification of the uncertainty in a derived quantity. This SDOM, in turn, can be used for constructing confidence intervals for the derived quantity.
Bootstrap methods (such as the bias-corrected bootstrap method) provide another way of obtaining confidence intervals for the derived quantity.

The following R code shows how to compute confidence intervals for a derived physical quantity with (1) the addition in quadrature procedure, and (2) the bias-corrected bootstrap method. The code demonstrates that these two methods usually yield very similar confidence intervals.

## Error propagation in R: addition in quadrature and the delta method

Physicists and engineers often have to calculate the uncertainty in a derived quantity.

For instance, a test engineer measures two angles. The uncertainty (or error) in these measurements appears to be +/- 1 degree. Subsequently, the engineer calculates the sum of these two angles. This sum is a derived quantity. But note that this derived quantity is composed of two measurements each having their own uncertainties, so what is the uncertainty (or error) in this derived quantity? In other words, how propagates the uncertainty from the measured quantities (the two angles) to a derived quantity (sum of two angles). For calculating the uncertainty in this derived quantity, physicists and engineers rely on what is called the addition in quadrature procedure.

Not known to all physicists and engineers, however, is that the addition in quadrature procedure is exactly the same as what statisticians call the delta method. But the opposite is also true: not all statisticians seem to realize that the delta method is identical to the addition in quadrature method used by physicists and engineers.

The following R code demonstrates how to calculate the uncertainty in physical measurements using the delta method. The resulting uncertainty is always identical to that obtained by the addition in quadrature procedure.