# Propagation of uncertainty

Short description: Effect of variables' uncertainties on the uncertainty of a function based on them

In statistics, propagation of uncertainty (or propagation of error) is the effect of variables' uncertainties (or errors, more specifically random errors) on the uncertainty of a function based on them. When the variables are the values of experimental measurements they have uncertainties due to measurement limitations (e.g., instrument precision) which propagate due to the combination of variables in the function.

The uncertainty u can be expressed in a number of ways. It may be defined by the absolute error Δx. Uncertainties can also be defined by the relative error x)/x, which is usually written as a percentage. Most commonly, the uncertainty on a quantity is quantified in terms of the standard deviation, σ, which is the positive square root of the variance. The value of a quantity and its error are then expressed as an interval x ± u. If the statistical probability distribution of the variable is known or can be assumed, it is possible to derive confidence limits to describe the region within which the true value of the variable may be found. For example, the 68% confidence limits for a one-dimensional variable belonging to a normal distribution are approximately ± one standard deviation σ from the central value x, which means that the region x ± σ will cover the true value in roughly 68% of cases.

If the uncertainties are correlated then covariance must be taken into account. Correlation can arise from two different sources. First, the measurement errors may be correlated. Second, when the underlying values are correlated across a population, the uncertainties in the group averages will be correlated. For very expensive data or complex functions, the error propagation may be achieved with a surrogate model, e.g. based on Bayesian probability theory.

## Linear combinations

Let $\displaystyle{ \{f_k(x_1, x_2, \dots, x_n)\} }$ be a set of m functions, which are linear combinations of $\displaystyle{ n }$ variables $\displaystyle{ x_1, x_2, \dots, x_n }$ with combination coefficients $\displaystyle{ A_{k1}, A_{k2}, \dots,A_{kn}, (k = 1, \dots, m) }$:

$\displaystyle{ f_k = \sum_{i=1}^n A_{ki} x_i, }$

or in matrix notation,

$\displaystyle{ \mathbf{f} = \mathbf{Ax}. }$

Also let the variance–covariance matrix of x = (x1, ..., xn) be denoted by $\displaystyle{ \boldsymbol\Sigma^x }$ and let the mean value be denoted by $\displaystyle{ \mathbf{\mu} }$:

$\displaystyle{ \boldsymbol\Sigma^x = E[\mathbf{(x-\mu)}\otimes \mathbf{(x-\mu)}]= \begin{pmatrix} \sigma^2_1 & \sigma_{12} & \sigma_{13} & \cdots \\ \sigma_{21} & \sigma^2_2 & \sigma_{23} & \cdots\\ \sigma_{31} & \sigma_{32} & \sigma^2_3 & \cdots \\ \vdots & \vdots & \vdots & \ddots \end{pmatrix} = \begin{pmatrix} {\Sigma}^x_{11} & {\Sigma}^x_{12} & {\Sigma}^x_{13} & \cdots \\ {\Sigma}^x_{21} & {\Sigma}^x_{22} & {\Sigma}^x_{23} & \cdots\\ {\Sigma}^x_{31} & {\Sigma}^x_{32} & {\Sigma}^x_{33} & \cdots \\ \vdots & \vdots & \vdots & \ddots \end{pmatrix}. }$

$\displaystyle{ \otimes }$ is the outer product.

Then, the variance–covariance matrix $\displaystyle{ \boldsymbol\Sigma^f }$ of f is given by

$\displaystyle{ \boldsymbol\Sigma^f = E[(\mathbf{f}-E[\mathbf{f}])\otimes (\mathbf{f}-E[\mathbf{f}])] = E[\mathbf{A(x-\mu)}\otimes \mathbf{A(x-\mu)}] = \mathbf{A} E[\mathbf{(x-\mu)}\otimes \mathbf{(x-\mu)}]\mathbf{A}^\mathrm{T} = \mathbf{A} \boldsymbol\Sigma^x \mathbf{A}^\mathrm{T} }$

In component notation, the equation

$\displaystyle{ \boldsymbol\Sigma^f = \mathbf{A} \boldsymbol\Sigma^x \mathbf{A}^\mathrm{T}. }$

$\displaystyle{ \Sigma^f_{ij} = \sum_k^n \sum_l^n A_{ik} {\Sigma}^x_{kl} A_{jl}. }$

This is the most general expression for the propagation of error from one set of variables onto another. When the errors on x are uncorrelated, the general expression simplifies to

$\displaystyle{ \Sigma^f_{ij} = \sum_k^n A_{ik} \Sigma^x_k A_{jk}, }$

where $\displaystyle{ \Sigma^x_k = \sigma^2_{x_k} }$ is the variance of k-th element of the x vector. Note that even though the errors on x may be uncorrelated, the errors on f are in general correlated; in other words, even if $\displaystyle{ \boldsymbol\Sigma^x }$ is a diagonal matrix, $\displaystyle{ \boldsymbol\Sigma^f }$ is in general a full matrix.

The general expressions for a scalar-valued function f are a little simpler (here a is a row vector):

$\displaystyle{ f = \sum_i^n a_i x_i = \mathbf{a x}, }$
$\displaystyle{ \sigma^2_f = \sum_i^n \sum_j^n a_i \Sigma^x_{ij} a_j = \mathbf{a} \boldsymbol\Sigma^x \mathbf{a}^\mathrm{T}. }$

Each covariance term $\displaystyle{ \sigma_{ij} }$ can be expressed in terms of the correlation coefficient $\displaystyle{ \rho_{ij} }$ by $\displaystyle{ \sigma_{ij} = \rho_{ij} \sigma_i \sigma_j }$, so that an alternative expression for the variance of f is

$\displaystyle{ \sigma^2_f = \sum_i^n a_i^2 \sigma^2_i + \sum_i^n \sum_{j (j \ne i)}^n a_i a_j \rho_{ij} \sigma_i \sigma_j. }$

In the case that the variables in x are uncorrelated, this simplifies further to

$\displaystyle{ \sigma^2_f = \sum_i^n a_i^2 \sigma^2_i. }$

In the simple case of identical coefficients and variances, we find

$\displaystyle{ \sigma_f = \sqrt{n}\, |a| \sigma. }$

For the arithmetic mean, $\displaystyle{ a=1/n }$, the result is the standard error of the mean:

$\displaystyle{ \sigma_f = \sigma / \sqrt{n}. }$

## Non-linear combinations

When f is a set of non-linear combination of the variables x, an interval propagation could be performed in order to compute intervals which contain all consistent values for the variables. In a probabilistic approach, the function f must usually be linearised by approximation to a first-order Taylor series expansion, though in some cases, exact formulae can be derived that do not depend on the expansion as is the case for the exact variance of products. The Taylor expansion would be:

$\displaystyle{ f_k \approx f^0_k+ \sum_i^n \frac{\partial f_k}{\partial {x_i}} x_i }$

where $\displaystyle{ \partial f_k/\partial x_i }$ denotes the partial derivative of fk with respect to the i-th variable, evaluated at the mean value of all components of vector x. Or in matrix notation,

$\displaystyle{ \mathrm{f} \approx \mathrm{f}^0 + \mathrm{J} \mathrm{x}\, }$

where J is the Jacobian matrix. Since f0 is a constant it does not contribute to the error on f. Therefore, the propagation of error follows the linear case, above, but replacing the linear coefficients, Aki and Akj by the partial derivatives, $\displaystyle{ \frac{\partial f_k}{\partial x_i} }$ and $\displaystyle{ \frac{\partial f_k}{\partial x_j} }$. In matrix notation,

$\displaystyle{ \mathrm{\Sigma}^\mathrm{f} = \mathrm{J} \mathrm{\Sigma}^\mathrm{x} \mathrm{J}^\top. }$

That is, the Jacobian of the function is used to transform the rows and columns of the variance-covariance matrix of the argument. Note this is equivalent to the matrix expression for the linear case with $\displaystyle{ \mathrm{J = A} }$.

### Simplification

Neglecting correlations or assuming independent variables yields a common formula among engineers and experimental scientists to calculate error propagation, the variance formula:

$\displaystyle{ s_f = \sqrt{ \left(\frac{\partial f}{\partial x}\right)^2 s_x^2 + \left(\frac{\partial f}{\partial y} \right)^2 s_y^2 + \left(\frac{\partial f}{\partial z} \right)^2 s_z^2 + \cdots} }$

where $\displaystyle{ s_f }$ represents the standard deviation of the function $\displaystyle{ f }$, $\displaystyle{ s_x }$ represents the standard deviation of $\displaystyle{ x }$, $\displaystyle{ s_y }$ represents the standard deviation of $\displaystyle{ y }$, and so forth.

It is important to note that this formula is based on the linear characteristics of the gradient of $\displaystyle{ f }$ and therefore it is a good estimation for the standard deviation of $\displaystyle{ f }$ as long as $\displaystyle{ s_x, s_y, s_z,\ldots }$ are small enough. Specifically, the linear approximation of $\displaystyle{ f }$ has to be close to $\displaystyle{ f }$ inside a neighbourhood of radius $\displaystyle{ s_x, s_y, s_z,\ldots }$.

### Example

Any non-linear differentiable function, $\displaystyle{ f(a,b) }$, of two variables, $\displaystyle{ a }$ and $\displaystyle{ b }$, can be expanded as

$\displaystyle{ f\approx f^0+\frac{\partial f}{\partial a}a+\frac{\partial f}{\partial b}b }$

now, taking variance on both sides, and using the formula for variance of a linear combination of variables:

$\displaystyle{ Var(aX+bY)=a^2Var(X)+b^2Var(Y)+2ab*Cov(X,Y) }$

hence:

$\displaystyle{ \sigma^2_f\approx\left| \frac{\partial f}{\partial a}\right| ^2\sigma^2_a+\left| \frac{\partial f}{\partial b}\right|^2\sigma^2_b+2\frac{\partial f}{\partial a}\frac{\partial f} {\partial b}\sigma_{ab} }$

where $\displaystyle{ \sigma_{f} }$ is the standard deviation of the function $\displaystyle{ f }$, $\displaystyle{ \sigma_{a} }$ is the standard deviation of $\displaystyle{ a }$, $\displaystyle{ \sigma_{b} }$ is the standard deviation of $\displaystyle{ b }$ and $\displaystyle{ \sigma_{ab}=\sigma_{a}\sigma_{b}\rho_{ab} }$ is the covariance between $\displaystyle{ a }$ and $\displaystyle{ b }$.

In the particular case that $\displaystyle{ f=ab }$, $\displaystyle{ \frac{\partial f}{\partial a}=b, \frac{\partial f}{\partial b}=a }$. Then

$\displaystyle{ \sigma^2_f \approx b^2\sigma^2_a+a^2 \sigma_b^2+2ab\,\sigma_{ab} }$

or

$\displaystyle{ \left(\frac{\sigma_f}{f}\right)^2 \approx \left(\frac{\sigma_a}{a} \right)^2 + \left(\frac{\sigma_b}{b}\right)^2 + 2\left(\frac{\sigma_a}{a}\right)\left(\frac{\sigma_b}{b}\right)\rho_{ab} }$

where $\displaystyle{ \rho_{ab} }$ is the correlation between $\displaystyle{ a }$ and $\displaystyle{ b }$.

When the variables $\displaystyle{ a }$ and $\displaystyle{ b }$ are uncorrelated, $\displaystyle{ \rho_{ab}=0 }$. Then

$\displaystyle{ \left(\frac{\sigma_f}{f}\right)^2 \approx \left(\frac{\sigma_a}{a} \right)^2 + \left(\frac{\sigma_b}{b}\right)^2. }$

### Caveats and warnings

Error estimates for non-linear functions are biased on account of using a truncated series expansion. The extent of this bias depends on the nature of the function. For example, the bias on the error calculated for log(1+x) increases as x increases, since the expansion to x is a good approximation only when x is near zero.

For highly non-linear functions, there exist five categories of probabilistic approaches for uncertainty propagation; see Uncertainty quantification for details.

#### Reciprocal and shifted reciprocal

In the special case of the inverse or reciprocal $\displaystyle{ 1/B }$, where $\displaystyle{ B=N(0,1) }$ follows a standard normal distribution, the resulting distribution is a reciprocal standard normal distribution, and there is no definable variance.

However, in the slightly more general case of a shifted reciprocal function $\displaystyle{ 1/(p-B) }$ for $\displaystyle{ B=N(\mu,\sigma) }$ following a general normal distribution, then mean and variance statistics do exist in a principal value sense, if the difference between the pole $\displaystyle{ p }$ and the mean $\displaystyle{ \mu }$ is real-valued.

#### Ratios

Ratios are also problematic; normal approximations exist under certain conditions.

## Example formulae

This table shows the variances and standard deviations of simple functions of the real variables $\displaystyle{ A,B\! }$, with standard deviations $\displaystyle{ \sigma_A, \sigma_B,\, }$ covariance $\displaystyle{ \sigma_{AB}=\rho_{AB}\sigma_A\sigma_B\, }$, and correlation $\displaystyle{ \rho_{AB} }$. The real-valued coefficients $\displaystyle{ a }$ and $\displaystyle{ b }$ are assumed exactly known (deterministic), i.e., $\displaystyle{ \sigma_a=\sigma_b=0 }$.

In the columns "Variance" and "Standard Deviation", A and B should be understood as expectation values (i.e. values around which we're estimating the uncertainty), and $\displaystyle{ f }$ should be understood as the value of the function calculated at the expectation value of $\displaystyle{ A,B\! }$.

Function Variance Standard Deviation
$\displaystyle{ f = aA\, }$ $\displaystyle{ \sigma_f^2 = a^2\sigma_A^2 }$ $\displaystyle{ \sigma_f = |a|\sigma_A }$
$\displaystyle{ f = aA + bB\, }$ $\displaystyle{ \sigma_f^2 = a^2\sigma_A^2 + b^2\sigma_B^2 + 2ab\,\sigma_{AB} }$ $\displaystyle{ \sigma_f = \sqrt{a^2\sigma_A^2 + b^2\sigma_B^2 + 2ab\,\sigma_{AB}} }$
$\displaystyle{ f = aA - bB\, }$ $\displaystyle{ \sigma_f^2 = a^2\sigma_A^2 + b^2\sigma_B^2 - 2ab\,\sigma_{AB} }$ $\displaystyle{ \sigma_f = \sqrt{a^2\sigma_A^2 + b^2\sigma_B^2 - 2ab\,\sigma_{AB}} }$
$\displaystyle{ f = A - B, }$ $\displaystyle{ \sigma_f^2 = \sigma_A^2 + \sigma_B^2 - 2\sigma_{AB} }$ $\displaystyle{ \sigma_f = \sqrt{\sigma_A^2 + \sigma_B^2 - 2\sigma_{AB}} }$
$\displaystyle{ f = aA - aA, }$ $\displaystyle{ \sigma_f^2 = 2 a^2 \sigma_A^2(1-\rho_A) }$ $\displaystyle{ \sigma_f = \sqrt{2}\left|a\right|\sigma_A(1-\rho_A)^{1/2} }$
$\displaystyle{ f = AB\, }$ $\displaystyle{ \sigma_f^2 \approx f^2 \left[\left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2 + 2\frac{\sigma_{AB}}{AB} \right] }$ $\displaystyle{ \sigma_f \approx \left| f \right| \sqrt{ \left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2 + 2\frac{\sigma_{AB}}{AB} } }$
$\displaystyle{ f = \frac{A}{B}\, }$ $\displaystyle{ \sigma_f^2 \approx f^2 \left[\left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2 - 2\frac{\sigma_{AB}}{AB} \right] }$ $\displaystyle{ \sigma_f \approx \left| f \right| \sqrt{ \left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2 - 2\frac{\sigma_{AB}}{AB} } }$
$\displaystyle{ f = a A^{b}\, }$ $\displaystyle{ \sigma_f^2 \approx \left( {a}{b}{A}^{b-1}{\sigma_A} \right)^2 = \left( \frac{{f}{b}{\sigma_A}}{A} \right)^2 }$ $\displaystyle{ \sigma_f \approx \left| {a}{b}{A}^{b-1}{\sigma_A} \right| = \left| \frac{{f}{b}{\sigma_A}}{A} \right| }$
$\displaystyle{ f = a \ln(bA)\, }$ $\displaystyle{ \sigma_f^2 \approx \left(a \frac{\sigma_A}{A} \right)^2 }$ $\displaystyle{ \sigma_f \approx \left| a \frac{\sigma_A}{A}\right| }$
$\displaystyle{ f = a \log_{10}(bA)\, }$ $\displaystyle{ \sigma_f^2 \approx \left(a \frac{\sigma_A}{A \ln(10)} \right)^2 }$ $\displaystyle{ \sigma_f \approx \left| a \frac{\sigma_A}{A \ln(10)} \right| }$
$\displaystyle{ f = a e^{bA}\, }$ $\displaystyle{ \sigma_f^2 \approx f^2 \left( b\sigma_A \right)^2 }$ $\displaystyle{ \sigma_f \approx \left| f \right| \left| \left( b\sigma_A \right) \right| }$
$\displaystyle{ f = a^{bA}\, }$ $\displaystyle{ \sigma_f^2 \approx f^2 (b\ln(a)\sigma_A)^2 }$ $\displaystyle{ \sigma_f \approx \left| f \right| \left| (b\ln(a)\sigma_A) \right| }$
$\displaystyle{ f = a \sin(bA)\, }$ $\displaystyle{ \sigma_f^2 \approx \left[ a b \cos(b A) \sigma_A \right]^2 }$ $\displaystyle{ \sigma_f \approx \left| a b \cos(b A) \sigma_A \right| }$
$\displaystyle{ f = a \cos \left( b A \right)\, }$ $\displaystyle{ \sigma_f^2 \approx \left[ a b \sin(b A) \sigma_A \right]^2 }$ $\displaystyle{ \sigma_f \approx \left| a b \sin(b A) \sigma_A \right| }$
$\displaystyle{ f = a \tan \left( b A \right)\, }$ $\displaystyle{ \sigma_f^2 \approx \left[ a b \sec^2(b A) \sigma_A \right]^2 }$ $\displaystyle{ \sigma_f \approx \left| a b \sec^2(b A) \sigma_A \right| }$
$\displaystyle{ f = A^B\, }$ $\displaystyle{ \sigma_f^2 \approx f^2 \left[ \left( \frac{B}{A}\sigma_A \right)^2 +\left( \ln(A)\sigma_B \right)^2 + 2 \frac{B \ln(A)}{A} \sigma_{AB} \right] }$ $\displaystyle{ \sigma_f \approx \left| f \right| \sqrt{ \left( \frac{B}{A}\sigma_A \right)^2 +\left( \ln(A)\sigma_B \right)^2 + 2 \frac{B \ln(A)}{A} \sigma_{AB} } }$
$\displaystyle{ f = \sqrt{aA^2 \pm bB^2}\, }$ $\displaystyle{ \sigma_f^2 \approx \left(\frac{A}{f}\right)^2 a^2\sigma_A^2 + \left(\frac{B}{f}\right)^2 b^2\sigma_B^2 \pm 2ab\frac{AB}{f^2}\,\sigma_{AB} }$ $\displaystyle{ \sigma_f \approx \sqrt{\left(\frac{A}{f}\right)^2 a^2\sigma_A^2 + \left(\frac{B}{f}\right)^2 b^2\sigma_B^2 \pm 2ab\frac{AB}{f^2}\,\sigma_{AB}} }$

For uncorrelated variables ($\displaystyle{ \rho_{AB}=0 }$, $\displaystyle{ \sigma_{AB}=0 }$) expressions for more complicated functions can be derived by combining simpler functions. For example, repeated multiplication, assuming no correlation, gives

$\displaystyle{ f = ABC; \qquad \left(\frac{\sigma_f}{f}\right)^2 \approx \left(\frac{\sigma_A}{A}\right)^2 + \left(\frac{\sigma_B}{B}\right)^2+ \left(\frac{\sigma_C}{C}\right)^2. }$

For the case $\displaystyle{ f = AB }$ we also have Goodman's expression for the exact variance: for the uncorrelated case it is

$\displaystyle{ V(XY)= E(X)^2 V(Y) + E(Y)^2 V(X) + E((X-E(X))^2 (Y-E(Y))^2) }$

and therefore we have:

$\displaystyle{ \sigma_f^2 = A^2\sigma_B^2 + B^2\sigma_A^2 + \sigma_A^2\sigma_B^2 }$

### Effect of correlation on differences

If A and B are uncorrelated, their difference A-B will have more variance than either of them. An increasing positive correlation ($\displaystyle{ \rho_{AB}\to 1 }$) will decrease the variance of the difference, converging to zero variance for perfectly correlated variables with the same variance. On the other hand, a negative correlation ($\displaystyle{ \rho_{AB}\to -1 }$) will further increase the variance of the difference, compared to the uncorrelated case.

For example, the self-subtraction f=A-A has zero variance $\displaystyle{ \sigma_f^2=0 }$ only if the variate is perfectly autocorrelated ($\displaystyle{ \rho_A=1 }$). If A is uncorrelated, $\displaystyle{ \rho_A=0 }$, then the output variance is twice the input variance, $\displaystyle{ \sigma_f^2=2\sigma^2_A }$. And if A is perfectly anticorrelated, $\displaystyle{ \rho_A=-1 }$, then the input variance is quadrupled in the output, $\displaystyle{ \sigma_f^2=4\sigma^2_A }$ (notice $\displaystyle{ 1-\rho_A=2 }$ for f = aA - aA in the table above).

## Example calculations

### Inverse tangent function

We can calculate the uncertainty propagation for the inverse tangent function as an example of using partial derivatives to propagate error.

Define

$\displaystyle{ f(x) = \arctan(x), }$

where $\displaystyle{ \Delta_x }$ is the absolute uncertainty on our measurement of x. The derivative of f(x) with respect to x is

$\displaystyle{ \frac{d f}{d x} = \frac{1}{1+x^2}. }$

Therefore, our propagated uncertainty is

$\displaystyle{ \Delta_{f} \approx \frac{\Delta_x}{1+x^2}, }$

where $\displaystyle{ \Delta_f }$ is the absolute propagated uncertainty.

### Resistance measurement

A practical application is an experiment in which one measures current, I, and voltage, V, on a resistor in order to determine the resistance, R, using Ohm's law, R = V / I.

Given the measured variables with uncertainties, I ± σI and V ± σV, and neglecting their possible correlation, the uncertainty in the computed quantity, σR, is:

$\displaystyle{ \sigma_R \approx \sqrt{ \sigma_V^2 \left(\frac{1}{I}\right)^2 + \sigma_I^2 \left(\frac{-V}{I^2}\right)^2 } = R\sqrt{ \left(\frac{\sigma_V}{V}\right)^2 + \left(\frac{\sigma_I}{I}\right)^2 }. }$