dotVariance

fiducia.stats.dotVariance(a, b, aUncertainty=None, bUncertainty=None)[source]

Propogate uncertainty for the dot product of matrix a and 1D vector b.

Propogate uncertainty for the dot product of a matrix and a 1D vector. Assumes no covariance between a and b. Methodology is similar to numpy.dot() where:

  • If both a and b are 1D, the uncertainty of the inner product of vectors is returned.

  • If ‘a’ is N dimensional (Where :math: N>=2) and b is 1D, the uncertainty of the sum product of the last axis of a with b is returned.

0-D (scalar) arrays are not supported. b arrays that have more than one axis are not supported. a and b must have the same shape as aUncertainty and bUncertainty, respectively.

Parameters
  • a (numpy.ndarray, list) – Matrix or vector to dot with ‘b’.

  • b (numpy.ndarray, list) – Vector that ‘a’ will be dotted with. Must be the same size as the last axis of a.

  • aUncertainty (numpy.ndarray, optional) – Uncertainty of each element in ‘a’. The default is None.

  • bUncertainty (numpy.ndarray, optional) – Uncertainty of each element in ‘b’. The default is None.

Returns

variance

Return type

float

Notes

\[\operatorname{Var}(A \cdot B) = \sum_{i=1}^N \operatorname{Var}(a_i b_i)\]

Assuming covariance between independent variables

\[\sum_{i=1}^N (a_i\sigma_{b_i})^2 + (b_i\sigma_{a_i})^2\]

Examples