Advanced Octave A26 — Linear propagation of uncertainty
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
- What are the dimensions of
J,CandJ*C*J'? - How much is the variance of the sum worth if the crossed covariance becomes zero?
- Does the only standard uncertainty automatically define a range of 95%?
Worked solution
1×2,2×2and1×1.0,04 + 0,09 = 0,13 V².- No. We need hypotheses and an appropriate method to define coverage.
Other steps of this project
- Advanced Octave A75 — Dynamical systems in phase space
- Advanced Octave A81 — Geography of the waves and a 3D surface
- Advanced Octave A82 — Age, sex and demographic inequalities
- Advanced Octave A83 — All-cause mortality, certified COVID deaths and surveillance
- Advanced Octave A84 — A reproducible public account
- Advanced Octave A73 — Optimization landscapes and 3D trajectories