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. 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.
Examples
Basic example Given two school classes — one with 20 students, one with 30 students — and test grades in each class as follows:
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 mean for the morning class is 80 and the mean of the afternoon class is 90. The unweighted mean of the two means is 85. 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):
x ¯ = 4300 50 = 86. {\displaystyle {\bar {x}}={\frac {4300}{50}}=86.}
Or, this can be accomplished by weighting the class means by the number of students in each class. The larger class is given more "weight":
x ¯ = ( 20 × 80 ) + ( 30 × 90 ) 20 + 30 = 86. {\displaystyle {\bar {x}}={\frac {(20\times 80)+(30\times 90)}{20+30}}=86.}
Thus, the weighted mean makes it possible to find the mean average student grade without knowing each student's score. Only the class means and the number of students in each class are needed.
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:
20 20 + 30 = 0.4 {\displaystyle {\frac {20}{20+30}}=0.4}
30 20 + 30 = 0.6 {\displaystyle {\frac {30}{20+30}}=0.6}
Then, apply the weights like this:
x ¯ = ( 0.4 × 80 ) + ( 0.6 × 90 ) = 86. {\displaystyle {\bar {x}}=(0.4\times 80)+(0.6\times 90)=86.}
Mathematical definition Formally, the weighted mean of a non-empty finite tuple of data ( x 1 , x 2 , … , x n ) {\displaystyle \left(x_{1},x_{2},\dots ,x_{n}\right)} , with corresponding non-negative weights ( w 1 , w 2 , … , w n ) {\displaystyle \left(w_{1},w_{2},\dots ,w_{n}\right)} is
x ¯ = ∑ i = 1 n w i x i ∑ i = 1 n w i , {\displaystyle {\bar {x}}={\frac {\sum \limits _{i=1}^{n}w_{i}x_{i}}{\sum \limits _{i=1}^{n}w_{i}}},}
which expands to:
x ¯ = w 1 x 1 + w 2 x 2 + ⋯ + w n x n w 1 + w 2 + ⋯ + w n . {\displaystyle {\bar {x}}={\frac {w_{1}x_{1}+w_{2}x_{2}+\cdots +w_{n}x_{n}}{w_{1}+w_{2}+\cdots +w_{n}}}.}
Therefore, data elements with a high weight contribute more to the weighted mean than do elements with a low weight. The weights may not be negative in order for the equation to work. 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 1, i.e., ∑ i = 1 n w i ′ = 1 {\textstyle \sum \limits _{i=1}^{n}{w_{i}'}=1} . For such normalized weights, the weighted mean is equivalently:
x ¯ = ∑ i = 1 n w i ′ x i {\displaystyle {\bar {x}}=\sum \limits _{i=1}^{n}{w_{i}'x_{i}}} . One can always normalize the weights by making the following transformation on the original weights:
w i ′ = w i ∑ j = 1 n w j {\displaystyle w_{i}'={\frac {w_{i}}{\sum \limits _{j=1}^{n}{w_{j}}}}} . The ordinary mean 1 n ∑ i = 1 n x i {\textstyle {\frac {1}{n}}\sum \limits _{i=1}^{n}{x_{i}}} is a special case of the weighted mean where all data have equal weights. If the data elements are independent and identically distributed random variables with variance σ 2 {\displaystyle \sigma ^{2}} , the standard error of the weighted mean, σ x ¯ {\displaystyle \sigma _{\bar {x}}} , can be shown via uncertainty propagation to be:
σ x ¯ = σ ∑ i = 1 n w i ′ 2 {\textstyle \sigma _{\bar {x}}=\sigma {\sqrt {\sum \limits _{i=1}^{n}w_{i}'^{2}}}}
Variance-defined weights
For the weighted mean of a list of data for which each element x i {\displaystyle x_{i}} potentially comes from a different probability distribution with known variance σ i 2 {\displaystyle \sigma _{i}^{2}} , all having the same mean, one possible choice for the weights is given by the reciprocal of variance:
w i = 1 σ i 2 . {\displaystyle w_{i}={\frac {1}{\sigma _{i}^{2}}}.}
The weighted mean in this case is:
x ¯ = ∑ i = 1 n ( x i σ i 2 ) ∑ i = 1 n 1 σ i 2 = ∑ i = 1 n ( x i ⋅ w i ) ∑ i = 1 n w i , {\displaystyle {\bar {x}}={\frac {\sum _{i=1}^{n}\left({\dfrac {x_{i}}{\sigma _{i}^{2}}}\right)}{\sum _{i=1}^{n}{\dfrac {1}{\sigma _{i}^{2}}}}}={\frac {\sum _{i=1}^{n}\left(x_{i}\cdot w_{i}\right)}{\sum _{i=1}^{n}w_{i}}},}
and the standard error of the weighted mean (with inverse-variance weights) is:
σ x ¯ = 1 ∑ i = 1 n σ i − 2 = 1 ∑ i = 1 n w i , {\displaystyle \sigma _{\bar {x}}={\sqrt {\frac {1}{\sum _{i=1}^{n}\sigma _{i}^{-2}}}}={\sqrt {\frac {1}{\sum _{i=1}^{n}w_{i}}}},}
Note this reduces to σ x ¯ 2 = σ 0 2 / n {\displaystyle \sigma _{\bar {x}}^{2}=\sigma _{0}^{2}/n} when all σ i = σ 0 {\displaystyle \sigma _{i}=\sigma _{0}} . It is a special case of the general formula in previous section,
σ x ¯ 2 = ∑ i = 1 n w i ′ 2 σ i 2 = ∑ i = 1 n σ i − 4 σ i 2 ( ∑ i = 1 n σ i − 2 ) 2 . {\displaystyle \sigma _{\bar {x}}^{2}=\sum _{i=1}^{n}{w_{i}'^{2}\sigma _{i}^{2}}={\frac {\sum _{i=1}^{n}{\sigma _{i}^{-4}\sigma _{i}^{2}}}{\left(\sum _{i=1}^{n}\sigma _{i}^{-2}\right)^{2}}}.}
The equations above can be combined to obtain:
x ¯ = σ x ¯ 2 ∑ i = 1 n x i σ i 2 . {\displaystyle {\bar {x}}=\sigma _{\bar {x}}^{2}\sum _{i=1}^{n}{\frac {x_{i}}{\sigma _{i}^{2}}}.}
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.
Statistical properties
Expectancy The weighted sample mean, x ¯ {\displaystyle {\bar {x}}} , is itself a random variable. Its expected value and standard deviation are related to the expected values and standard deviations of the observations, as follows. For simplicity, we assume normalized weights (weights summing to one). If the observations have expected values
E ( x i ) = μ i , {\displaystyle E(x_{i})={\mu _{i}},}
then the weighted sample mean has expectation
E ( x ¯ ) = ∑ i = 1 n w i ′ μ i . {\displaystyle E({\bar {x}})=\sum _{i=1}^{n}{w_{i}'\mu _{i}}.}
In particular, if the means are equal, μ i = μ {\displaystyle \mu _{i}=\mu } , then the expectation of the weighted sample mean will be that value,
E ( x ¯ ) = μ . {\displaystyle E({\bar {x}})=\mu .}
Variance
Simple i.i.d. case When treating the weights as constants, and having a sample of n observations from uncorrelated random variables, all with the same variance and expectation (as is the case for i.i.d random variables), then the variance of the weighted mean can be estimated as the multiplication of the unweighted variance by Kish's design effect (see proof):
Var ( y ¯ w ) = σ ^ y 2 w 2 ¯ w ¯ 2 {\displaystyle \operatorname {Var} ({\bar {y}}_{w})={\hat {\sigma }}_{y}^{2}{\frac {\overline {w^{2}}}{{\bar {w}}^{2}}}}
With σ ^ y 2 = ∑ i = 1 n ( y i − y ¯ ) 2 n − 1 {\displaystyle {\hat {\sigma }}_{y}^{2}={\frac {\sum _{i=1}^{n}(y_{i}-{\bar {y}})^{2}}{n-1}}} , w ¯ = ∑ i = 1 n w i n {\displaystyle {\bar {w}}={\frac {\sum _{i=1}^{n}w_{i}}{n}}} , and w 2 ¯ = ∑ i = 1 n w i 2 n {\displaystyle {\overline {w^{2}}}={\frac {\sum _{i=1}^{n}w_{i}^{2}}{n}}}
However, this estimation is rather limited due to the strong assumption about the y observations. This has led to the development of alternative, more general, estimators.
Survey sampling perspective From a model based perspective, we are interested in estimating the variance of the weighted mean when the different y i {\displaystyle y_{i}} are not i.i.d random variables. An alternative perspective for this problem is that of some arbitrary sampling design of the data in which units are selected with unequal probabilities (with replacement). In Survey methodology, the population mean, of some quantity of interest y, is calculated by taking an estimation of the total of y over all elements in the population (Y or sometimes T) and dividing it by the population size – either known ( N {\displaystyle N} ) or estimated ( N ^ {\displaystyle {\hat {N}}} ). In this context, each value of y is considered constant, and the variability comes from the selection procedure. This in contrast to "model based" approaches in which the randomness is often described in the y values. The survey sampling procedure yields a series of Bernoulli indicator values ( I i {\displaystyle I_{i}} ) that get 1 if some observation i is in the sample and 0 if it was not selected. This can occur with fixed sample size, or varied sample size sampling (e.g.: Poisson sampling). The probability of some element to be chosen, given a sample, is denoted as P ( I i = 1 ∣ Some sample of size n ) = π i {\displaystyle P(I_{i}=1\mid {\text{Some sample of size }}n)=\pi _{i}} , and the one-draw probability of selection is P ( I i = 1 | one sample draw ) = p i ≈ π i n {\displaystyle P(I_{i}=1|{\text{one sample draw}})=p_{i}\approx {\frac {\pi _{i}}{n}}} (If N is very large and each p i {\displaystyle p_{i}} is very small). For the following derivation we'll assume that the probability of selecting each element is fully represented by these probabilities. I.e.: selecting some element will not influence the probability of drawing another element (this doesn't apply for things such as cluster sampling design). Since each element ( y i {\displaystyle y_{i}} ) is fixed, and the randomness comes from it being included in the sample or not ( I i {\displaystyle I_{i}} ), we often talk about the multiplication of the two, which is a random variable. To avoid confusion in the following section, let's call this term: y i ′ = y i I i {\displaystyle y'_{i}=y_{i}I_{i}} . With the following expectancy: E [ y i ′ ] = y i E [ I i ] = y i π i {\displaystyle E[y'_{i}]=y_{i}E[I_{i}]=y_{i}\pi _{i}} ; and variance: V [ y i ′ ] = y i 2 V [ I i ] = y i 2 π i ( 1 − π i ) {\displaystyle V[y'_{i}]=y_{i}^{2}V[I_{i}]=y_{i}^{2}\pi _{i}(1-\pi _{i})} . When each element of the sample is inflated by the inverse of its selection probability, it is termed the π {\displaystyle \pi } -expanded y values, i.e.: y ˇ i = y i π i {\displaystyle {\check {y}}_{i}={\frac {y_{i}}{\pi _{i}}}} . A related quantity is p {\displaystyle p} -expanded y values: y i p i = n y ˇ i {\displaystyle {\frac {y_{i}}{p_{i}}}=n{\check {y}}_{i}} . As above, we can add a tick mark if multiplying by the indicator function. I.e.: y ˇ i ′ = I i y ˇ i = I i y i π i {\displaystyle {\check {y}}'_{i}=I_{i}{\check {y}}_{i}={\frac {I_{i}y_{i}}{\pi _{i}}}}
In this design based perspective, the weights, used in the numerator of the weighted mean, are obtained from taking the inverse of the selection probability (i.e.: the inflation factor). I.e.: w i = 1 π i ≈ 1 n × p i {\displaystyle w_{i}={\frac {1}{\pi _{i}}}\approx {\frac {1}{n\times p_{i}}}} .
Variance of the weighted sum (pwr-estimator for totals) If the population size N is known we can estimate the population mean using Y ¯ ^ known N = Y ^ p w r N ≈ ∑ i = 1 n w i y i ′ N {\displaystyle {\hat {\bar {Y}}}_{{\text{known }}N}={\frac {{\hat {Y}}_{pwr}}{N}}\approx {\frac {\sum _{i=1}^{n}w_{i}y'_{i}}{N}}} . If the sampling design is one that results in a fixed sample size n (such as in pps sampling), then the variance of this estimator is:
Var ( Y ¯ ^ known N ) = 1 N 2 n n − 1 ∑ i = 1 n ( w i y i − w y ¯ ) 2 {\displaystyle \operatorname {Var} \left({\hat {\bar {Y}}}_{{\text{known }}N}\right)={\frac {1}{N^{2}}}{\frac {n}{n-1}}\sum _{i=1}^{n}\left(w_{i}y_{i}-{\overline {wy}}\right)^{2}}
An alternative term, for when the sampling has a random sample size (as in Poisson sampling), is presented in Sarndal et al. (1992) as:
Var ( Y ¯ ^ pwr (known N ) ) = 1 N 2 ∑ i = 1 n ∑ j = 1 n ( Δ ˇ i j y ˇ i y ˇ j ) {\displaystyle \operatorname {Var} ({\hat {\bar {Y}}}_{{\text{pwr (known }}N{\text{)}}})={\frac {1}{N^{2}}}\sum _{i=1}^{n}\sum _{j=1}^{n}\left({\check {\Delta }}_{ij}{\check {y}}_{i}{\check {y}}_{j}\right)}
With y ˇ i = y i π i {\displaystyle {\check {y}}_{i}={\frac {y_{i}}{\pi _{i}}}} . Also, C ( I i , I j ) = π i j