Weighted MeanΒΆ

Global Algorithm - One-Dimensional Algorithm

Weighted Mean of a data set is similar to the mean, but the values in the data set are weighted differently. The basic formula is stated as follows:

\[\mu_{\text{weighted}} = \frac{\sum_{i=1}^{N} w_i \cdot Y_i}{\sum_{i=1}^{N} w_i} \, \text{,}\]

where \(Y_i\) is the \(i\)th value in the data set, \(N\) is the length of the data vector and \(\mu_{\text{weighted}}\) is the weighted mean value.

Input Parameters

Parameter Type Constraint Description Remarks
\(Y\) \(Y \in \mathbb R^N\) \(N \in \mathbb{N}\) Input data vector of length \(N\)  
\(W\) \(W \in \mathbb R^N\) \(N \in \mathbb{N}\) Input weighting vector of length \(N\) If \(\sum w_i = 1\) , the algorithm simplifies to \(\mu_{\text{weighted}} = \sum w_i \cdot Y_i\) .

Output Parameters

Parameter Type Constraint Description Remarks
\(\mu_{\text{weighted}}\) \(\mu_{\text{weighted}} \in \mathbb R\)   Weighted mean value of data \(Y\) The result is sensitive to improper values such as ‘nan’, ‘inf’, ‘null’, etc.

Single Steps using the Algorithm