## Obtaining numerical results from uncertain numbers

Every uncertain real number has the attributes:- value
- uncertainty
- degrees of freedom

*Value*is the estimate of a quantity of interest.

*Uncertainty*is the standard uncertainty of this estimate and the

*degrees of freedom*is, well, the degrees of freedom associated with the uncertainty.

The numerical values of these attributes are used to calculate an

*expanded uncertainty*for a quantity of interest.

GTC functions can obtain attribute values from an uncertain number, or there is a set of Python object-attributes that do the same thing. For example, if

y = ureal(1.1,2.5,6)then

print value(y) print uncertainty(y) print dof(y)yields

1.1 2.5 6as does the more succinct form using object attributes

print y.x print y.u print y.df

### Expanded uncertainty

To calculate an expanded uncertainty, the standard uncertainty of a result is multiplied by a coverage factor \( k_p \) that depends on the number of degrees of freedom (\( p \) is the level of confidence, or coverage probability).For the uncertain number above (and for a 95% level of confidence)

k_95 = reporting.k_factor(y.df,p=95) U_95 = k_95 * y.uAlternatively, the lower and upper bounds of an uncertainty interval can be calculated directly

Y_lb, Y_ub = reporting.uncertainty_interval(y,p=95)The numbers obtained here are -5.017 and 7.217

### Uncertainty budgets

An uncertainty budget breaks down the various contributions to the combined uncertainty of a result.For example, the following three uncertain numbers are associated with measurements of voltage, current and phase in an electrical circuit

V = ureal(4.999,3.2E-3,label='V') # volt I = ureal(19.661E-3,9.5E-6,label='I') # amp phi = ureal(1.04446,7.5E-4,label='phi') # radianBased on these measurements, an uncertain number for the resistance \( R \) is

R = V * cos(phi) / IWe obtain a budget for this by writing

for cpt in reporting.budget(R): print "%s: %G" % cptwhich generates a list of names and components of uncertainty in the same units as the measurement result and in order of decreasing magnitude

phi: 0.164885 V: 0.0817649 I: 0.0617189This shows that phase is the most important source of measurement error. The contribution to uncertainty from a phase error is likely to be about twice as big as voltage and current errors.

### Correlation coefficients

Measurement results may become correlated if they share influence quantities, or are calculated from common data sets.Continuing with the example above, an estimate of reactance is

X = V * sin(phi) / INow, the estimates associated with R and X will not be independent, because they were calculated using the same set of data. Their correlation coefficient can be calculated by

get_correlation(R,X)(the value obtained is 0.058)