*Appendix A.1. Ensembles*

As noted in Section 2.1, the Welch-Satterthwaite formula cannot be used on correlated data with finite degrees of freedom. However, there is an extension that can be applied in situations where data are deemed to come from closely related quantities with fixed interdependencies [9]. To implement this, GTC algorithms must be able to identify sets of uncertain numbers declared as representing related quantities. The ensemble attribute of the Leaf node is used for this purpose (Figure 4). An ensemble is a set of Leaf nodes. There are some GTC functions that declare ensembles automatically, such as functions for linear regression; in other cases an ensemble can be explicitly defined by multiple\_ureal() (the GTC online documentation for multiple\_ureal() shows a calculation from GUM Appendix H2 [18]).

GTC includes regression functions that estimate the parameters of a straight line passing close to a sample of data. The finite sample size means that uncertainties in estimates for the slope and intercept have finite degrees of freedom and are usually correlated.

The code below shows a least-squares regression for nine data points. The GTC function line\_fit() returns an object with an attribute that holds a pair of uncertain numbers for the slope and intercept (a\_b).

```
from GTC import type_a, get_correlation
```

```
x = [1,2,3,4,5,6,7,8,9]
y = [15.6,17.5,36.6,43.8,58.2,61.6,64.2,70.4,98.8]
result = type_a.line_fit(x,y)
a,b = result.a_b
print("a =",repr(a))
print("b =",repr(b))
print("r(a,b) =",get_correlation(a,b))
```
The results are as follows.

```
a = ureal(4.813888888888881,4.886206312183354,7)
b = ureal(9.408333333333335,0.8683016476563609,7)
r(a,b) = -0.888523316639
```
The slope and intercept are correlated and there are seven degrees of freedom associated with the uncertainties. However, these results may still be used to calculate the expected value *y* for *x* = 5.5:

y\_p = a + b\*5.5 print("y\_p =", repr(y\_p))

which produces a result with seven degrees of freedom.

```
y_p = ureal(56.55972222222223,2.2835948151943155,7.0)
```