interpVariance¶
-
fiducia.stats.
interpVariance
(x, xp, fpUnc, leftVar=None, rightVar=None, period=None)[source]¶ Propagate uncertainty for linear interpolation.
- Parameters
x (numpy.ndarray, list) – The x-coordinates at which to evaluate the interpolated values.
xp (numpy.ndarray, list) – The 1D x-coordinates of the data points, must be increasing order
fpUnc (numpy.ndarray, list) – The uncertainty in the y-coordinates of the data points, same length as xp.
leftVar (float, optional) – Variance to return for x < xp[0]. If not given, the first yUnc element will be used. Default is None
rightVar (float, optional) – Variance to return for x > xp[-1]. If not given, the last yUnc element will be used. Default is None
- Returns
yVar – 1D array containing the variance for each interpolated x.
- Return type
numpy.ndarray
Notes
Variance of interpolated point, assuming no uncertainty in x and xp, and no covariance between y-coordinates, is given by
\[\operatorname{Var}(y) = \frac{1}{(x_1 - x_0)^2} ( (x_1 - x)^2 \sigma_{y_0}^2 + (x-x_0)^2 \sigma_{y_1}^2 )\]Examples