The weighted arithmetic mean is similar to an ordinary arithmetic mean (the most common type of average), except that instead of each of the data points contributing equally to the final average, some data points contribute more than others. The notion of weighted mean plays a role in descriptive statistics and also occurs in a more general form in several other areas of mathematics.
- Basic example
- Convex combination example
- Mathematical definition
- Statistical properties
- Dealing with variance
- Correcting for over or under dispersion
- Weighted sample variance
- Frequency weights
- Reliability weights
- Weighted sample covariance
- Vector valued estimates
- Accounting for correlations
- Decreasing strength of interactions
- Exponentially decreasing weights
- Weighted averages of functions
If all the weights are equal, then the weighted mean is the same as the arithmetic mean. While weighted means generally behave in a similar fashion to arithmetic means, they do have a few counterintuitive properties, as captured for instance in Simpson's paradox.
Given two school classes, one with 20 students, and one with 30 students, the grades in each class on a test were:Morning class = 62, 67, 71, 74, 76, 77, 78, 79, 79, 80, 80, 81, 81, 82, 83, 84, 86, 89, 93, 98 Afternoon class = 81, 82, 83, 84, 85, 86, 87, 87, 88, 88, 89, 89, 89, 90, 90, 90, 90, 91, 91, 91, 92, 92, 93, 93, 94, 95, 96, 97, 98, 99
The straight average for the morning class is 80 and the straight average of the afternoon class is 90. The straight average of 80 and 90 is 85, the mean of the two class means. However, this does not account for the difference in number of students in each class (20 versus 30); hence the value of 85 does not reflect the average student grade (independent of class). The average student grade can be obtained by averaging all the grades, without regard to classes (add all the grades up and divide by the total number of students):
Or, this can be accomplished by weighting the class means by the number of students in each class (using a weighted mean of the class means):
Thus, the weighted mean makes it possible to find the average student grade in the case where only the class means and the number of students in each class are available.
Convex combination example
Since only the relative weights are relevant, any weighted mean can be expressed using coefficients that sum to one. Such a linear combination is called a convex combination.
Using the previous example, we would get the following weights:
Then, apply the weights like this:
Formally, the weighted mean of a non-empty set of data
(where x represents a set of mean values) with non-negative weights
Therefore data elements with a high weight contribute more to the weighted mean than do elements with a low weight. The weights cannot be negative. Some may be zero, but not all of them (since division by zero is not allowed).
The formulas are simplified when the weights are normalized such that they sum up to
The common mean
The weighted sample mean,
If the observations have expected values
then the weighted sample mean has expectation
In particular, if the means are equal,
For uncorrelated observations with variances
whose square root
Consequently, if all the observations have equal variance,
Note that because one can always transform non-normalized weights to normalized weights all formula in this section can be adapted to non-normalized weights by replacing all
Dealing with variance
For the weighted mean of a list of data for which each element
The weighted mean in this case is:
and the variance of the weighted mean is:
which reduces to
The two equations above can be combined to obtain:
The significance of this choice is that this weighted mean is the maximum likelihood estimator of the mean of the probability distributions under the assumption that they are independent and normally distributed with the same mean.
Correcting for over- or under-dispersion
Weighted means are typically used to find the weighted mean of historical data, rather than theoretically generated data. In this case, there will be some error in the variance of each data point. Typically experimental errors may be underestimated due to the experimenter not taking into account all sources of error in calculating the variance of each data point. In this event, the variance in the weighted mean must be corrected to account for the fact that
when all data variances are equal,
Weighted sample variance
Typically when a mean is calculated it is important to know the variance and standard deviation about that mean. When a weighted mean
The biased weighted sample variance
For small samples, it is customary to use an unbiased estimator for the population variance. In normal unweighted samples, the N in the denominator (corresponding to the sample size) is changed to N − 1 (see Bessel's correction). In the weighted setting, there are actually two different unbiased estimators, one for the case of frequency weights and another for the case of reliability weights.
If the weights are frequency weights, then the unbiased estimator is:
This effectively applies Bessel's correction for frequency weights.
For example, if values
If the weights are instead non-random (reliability weights), we can determine a correction factor to yield an unbiased estimator. Taking expectations we have,
The final unbiased estimate of sample variance is:
The degrees of freedom of the weighted, unbiased sample variance vary accordingly from N − 1 down to 0.
The standard deviation is simply the square root of the variance above.
As a side note, other approaches have been described to compute the weighted sample variance.
Weighted sample covariance
In a weighted sample, each row vector
Then the weighted mean vector
And the weighted covariance matrix is given by:
Similarly to weighted sample variance, there are two different unbiased estimators depending on the type of the weights.
If the weights are frequency weights, the unbiased weighted estimate of the covariance matrix
In the case of reliability weights, the weights are normalized:
(If they are not, divide the weights by their sum to normalize prior to calculating
Then the weighted mean vector
and the unbiased weighted estimate of the covariance matrix
The reasoning here is the same as in the previous section.
Since we are assuming the weights are normalized, then
If all weights are the same, i.e.
The above generalizes easily to the case of taking the mean of vector-valued estimates. For example, estimates of position on a plane may have less certainty in one direction than another. As in the scalar case, the weighted mean of multiple estimates can provide a maximum likelihood estimate. We simply replace the variance
The weighted mean in this case is:
(where the order of the matrix-vector product is not commutative), in terms of the covariance of the weighted mean:
For example, consider the weighted mean of the point [1 0] with high variance in the second component and [0 1] with high variance in the first component. Then
then the weighted mean is:
which makes sense: the [1 0] estimate is "compliant" in the second component and the [0 1] estimate is compliant in the first component, so the weighted mean is nearly [1 1].
Accounting for correlations
In the general case, suppose that
Decreasing strength of interactions
Consider the time series of an independent variable
Exponentially decreasing weights
In the scenario described in the previous section, most frequently the decrease in interaction strength obeys a negative exponential law. If the observations are sampled at equidistant times, then exponential decrease is equivalent to decrease by a constant fraction
The damping constant
Weighted averages of functions
The concept of weighted average can be extended to functions. Weighted averages of functions play an important role in the systems of weighted differential and integral calculus.