Advanced Octave A26 — Linear propagation of uncertainty

by Giux GX-TXT, octave-en, scripts-en 2 min read

Advanced GNU Octave with GX-TXT · Module 05

The uncertainty of a result depends not only on the uncertainties of the inputs, but also on their correlation. Linear propagation uses a jacobiana and a matrix of covariance to describe this effect.

Objectives and prerequisites

We repeat the jacobiana of the A24 lesson and the statistical bases of the Course Octave. We will use NUMERIC_API_v1/propagate_uncertainty via the Bridge and compare the result with the Octave matricial product. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0.

Consider the y = x₁ + x₂ output, with J = [1, 1] jacobiana and C = [0,04, 0,01; 0,01, 0,09] synthetic covariance matrix. To make the model concrete, we can consider both sizes in volts: the covariances are in V². The numbers are hypothetical, not measures.

Propagate covariance

Import propagazione_covarianza.m, register it and run it in the Runner.

J = [1,1];
C = [0.04,0.01;0.01,0.09];
options = struct('input_kind','covariance');
result = gxtxt_api_call('NUMERIC_API_v1','propagate_uncertainty',{J,C,options});
fprintf('Analytical covariance J*C*J'': %.6f\n',J*C*J');
fprintf('Public propagation result:\n'); disp(result);

First order calculation uses Cᵧ = J C Jᵀ. With only one output, the resulting matrix contains only one value: the variance of the output. Standard uncertainty is the square root of variance.

In the test both the direct product and service return 0,15 V²; the standard uncertainty is about 0,3873 V. The positive covariance 0,01 V² appears twice in development: without that term, keeping the other values unchanged, the variance of the sum would be 0,13 V².

Hypotheses and interpretation

The input matrix must represent an admissible covariance and refer to the same variables and units of the jacobiana. For a non-linear model, the formula is a local propagation of first order: its adequacy depends on non-linearity and the extent of uncertainties. A standard uncertainty does not automatically specify a confidence interval or a cover level.

Exercise

  1. What are the dimensions of J, C and J*C*J'?
  2. How much is the variance of the sum worth if the crossed covariance becomes zero?
  3. Does the only standard uncertainty automatically define a range of 95%?

Worked solution

  1. 1×2, 2×2 and 1×1.
  2. 0,04 + 0,09 = 0,13 V².
  3. No. We need hypotheses and an appropriate method to define coverage.

Download the Module 05 scripts (ZIP)

#GNU Octave #GX-TXT #GX-TXT public APIs

Other steps of this project

Leave a Reply

Your email address will not be published. Required fields are marked *