# Correlated uncertainties

navigating through the docs. of Around one can read in the details that

When Around is used in computations, uncertainties are by default propagated using a first-order series approximation, assuming no correlations.

Question: is there any implemented way in which we could calculate correlated uncertainties? Could please someone provide any ref. / example of this?

Aclaration: By correlated uncertainties I meant to say that the covariance of two variables can't be neglected assuming its $$\sim 0$$, if I understood correctly.

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.

If the propagation of the errors, following what Around indicates, is calculated by a 1st-order series approximation, I assume that

$$\delta f(x_1,..., x_n) \approx \sqrt{\left(\frac{\partial f}{\partial x_1}\right)^2 \delta x_1 ^2 + ... \left(\frac{\partial f}{\partial x_n}\right)^2 \delta x_n ^2 } = \sqrt{\sum\limits_{i=1}^n \left(\frac{\partial f}{\partial x_i} \delta x_i \right)^2}$$

and not

$$\delta f \approx \sqrt{\sum\limits_{i=1}^n \left(\frac{\partial f}{\partial x_i} \delta x_i\right)^2 + 2 \sum\limits_{i=1}^n\sum\limits_{j=i+1}^n \rho_{x_i x_j} \left(\frac{\partial f}{\partial x_i} \delta x_i\right)\left(\frac{\partial f}{\partial x_j} \delta x_j\right)}$$ where $$\rho_{x_i x_j}$$ is the correlation term between variables.

I apologize beforehand if you find this a naive question

• What do you mean by "correlated uncertainties"? The definition and examples and references are welcome. Commented Nov 5, 2021 at 14:26
• BTW, the documentation to Around follows Napoleon's directions "Write shortly and unclearly". Commented Nov 5, 2021 at 14:33
• @user64494 I reformulate the question: what should we do if variables are correlated between each other? Would you use Around still or compute each term of the sum manually?
– nuwe
Commented Nov 5, 2021 at 14:47
• You need VectorAround to deal with correlated quantities. Commented Nov 5, 2021 at 14:55
• I find the documentation to VectorAround poor. Commented Nov 5, 2021 at 15:11

Here's an example of how you use VectorAround to do error propagation through a function of 3 variables that are correlated:

fun[x_, y_, z_] := x + y^2 + Sin[z]
AroundReplace[
fun[x, y, z], {x, y, z} ->
VectorAround[{1, 2, 4}, {{2, -1/4, 1/3}, {-1/4, 2/3, 1/5}, {1/3, 1/5, 1/2}}]
]


Around[4.243197504692072, 3.065729839846241]

Note that the answer is different when you throw away the correlations (which you can do by applying Around to VectorAround):

AroundReplace[
fun[x, y, z], {x, y, z} ->
Around@VectorAround[{1, 2, 4}, {{2, -1/4, 1/3}, {-1/4, 2/3, 1/5}, {1/3, 1/5, 1/2}}]
]


Around[4.243197504692072, 3.5889123224473614$$$$]

The documentation for VectorAround is certainly lacking examples as to how one might want to use that function. Here's my guess as to how it might be used:

(* Define a VectorAround object *)
xy = VectorAround[{x, y}, {{varx, covxy}, {covxy, vary}}]

(* Find the approximate uncertainty for the difference in two correlated random variables *)
AroundReplace[x - y, {x, y} -> xy]


(* Now for the ratio *)
AroundReplace[x/y, {x, y} -> xy]


(* Something more complicated *)
AroundReplace[x^2 Sin[y], {x, y} -> xy]
`