weighted_mean_twod#
- agabpylib.stats.moments.weighted_mean_twod(x, y, sx, sy, cxy)#
Provide the weighted mean of the vectors x and y.
The elements \((x_i, y_i)\) have covariance matrices:
\[\begin{split}\begin{pmatrix} s_x^2 & c_{xy}s_xs_y \\ c_{xy}s_xs_y & s_y^2 \end{pmatrix}\end{split}\]- Parameters:
x (float array (1D)) – Values of x-component of data vector
y (float array (1D)) – Values of y-component of data vector
sx (float array (1D)) – Uncertainties in x
sy (float array (1D)) – Uncertainties in y
cxy (float array (1D)) – Correlation coefficient of sx and sy
- Returns:
wx, wy (float) – Weighted means wx, wy.
covw (float array (2,2)) – Covariance matrix of the weighted mean.