fbpx
Wikipedia

Weighted arithmetic mean

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 Edit

Basic example Edit

Given two school classesone with 20 students, one with 30 studentsand 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):

 

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":

 

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 Edit

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:

 

Mathematical definition Edit

Formally, the weighted mean of a non-empty finite tuple of data  , with corresponding non-negative weights   is

 

which expands to:

 

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[a]. 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.,  . For such normalized weights, the weighted mean is equivalently:

 .

One can always normalize the weights by making the following transformation on the original weights:

 .

The ordinary mean   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  , the standard error of the weighted mean,  , can be shown via uncertainty propagation to be:

 

Variance-defined weights Edit

For the weighted mean of a list of data for which each element   potentially comes from a different probability distribution with known variance  , all having the same mean, one possible choice for the weights is given by the reciprocal of variance:

 

The weighted mean in this case is:

 

and the standard error of the weighted mean (with inverse-variance weights) is:

 

Note this reduces to   when all  . It is a special case of the general formula in previous section,

 

The 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.

Statistical properties Edit

Expectancy Edit

The weighted sample mean,  , 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

 
then the weighted sample mean has expectation
 
In particular, if the means are equal,  , then the expectation of the weighted sample mean will be that value,
 

Variance Edit

Simple i.i.d. case Edit

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):

 

With  ,  , and  

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 Edit

From a model based perspective, we are interested in estimating the variance of the weighted mean when the different   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).[1]: 306 

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 ( ) or estimated ( ). 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 ( ) 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  , and the one-draw probability of selection is   (If N is very large and each   is very small). For the following derivation we'll assume that the probability of selecting each element is fully represented by these probabilities.[2]: 42, 43, 51  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 ( ) is fixed, and the randomness comes from it being included in the sample or not ( ), 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:  . With the following expectancy:  ; and variance:  .

When each element of the sample is inflated by the inverse of its selection probability, it is termed the  -expanded y values, i.e.:  . A related quantity is  -expanded y values:  .[2]: 42, 43, 51, 52  As above, we can add a tick mark if multiplying by the indicator function. I.e.:  

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.:  .

Variance of the weighted sum (pwr-estimator for totals) Edit

If the population size N is known we can estimate the population mean using  .

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:

 
Proof

The general formula can be developed like this:

 

The population total is denoted as   and it may be estimated by the (unbiased) Horvitz–Thompson estimator, also called the  -estimator. This estimator can be itself estimated using the pwr-estimator (i.e.:  -expanded with replacement estimator, or "probability with replacement" estimator). With the above notation, it is:  .[2]: 51 

The estimated variance of the pwr-estimator is given by:[2]: 52 

 
where  .

The above formula was taken from Sarndal et al. (1992) (also presented in Cochran 1977), but was written differently.[2]: 52 [1]: 307 (11.35)  The left side is how the variance was written and the right side is how we've developed the weighted version:

 

And we got to the formula from above.

An alternative term, for when the sampling has a random sample size (as in Poisson sampling), is presented in Sarndal et al. (1992) as:[2]: 182 

 

With  . Also,   where   is the probability of selecting both i and j.[2]: 36  And  , and for i=j:  .[2]: 43 

If the selection probability are uncorrelated (i.e.:  ), and when assuming the probability of each element is very small, then:

 
Proof

We assume that   and that

 

Variance of the weighted mean (π-estimator for ratio-mean) Edit

The previous section dealt with estimating the population mean as a ratio of an estimated population total ( ) with a known population size ( ), and the variance was estimated in that context. Another common case is that the population size itself ( ) is unknown and is estimated using the sample (i.e.:  ). The estimation of   can be described as the sum of weights. So when   we get  . With the above notation, the parameter we care about is the ratio of the sums of  s, and 1s. I.e.:  . We can estimate it using our sample with:  . As we moved from using N to using n, we actually know that all the indicator variables get 1, so we could simply write:  . This will be the estimand for specific values of y and w, but the statistical properties comes when including the indicator variable  .[2]: 162, 163, 176 

This is called a Ratio estimator and it is approximately unbiased for R.[2]: 182 

In this case, the variability of the ratio depends on the variability of the random variables both in the numerator and the denominator - as well as their correlation. Since there is no closed analytical form to compute this variance, various methods are used for approximate estimation. Primarily Taylor series first-order linearization, asymptotics, and bootstrap/jackknife.[2]: 172  The Taylor linearization method could lead to under-estimation of the variance for small sample sizes in general, but that depends on the complexity of the statistic. For the weighted mean, the approximate variance is supposed to be relatively accurate even for medium sample sizes.[2]: 176  For when the sampling has a random sample size (as in Poisson sampling), it is as follows:[2]: 182 

 .

If  , then either using   or   would give the same estimator, since multiplying   by some factor would lead to the same estimator. It also means that if we scale the sum of weights to be equal to a known-from-before population size N, the variance calculation would look the same. When all weights are equal to one another, this formula is reduced to the standard unbiased variance estimator.

Proof

The Taylor linearization states that for a general ratio estimator of two sums ( ), they can be expanded around the true value R, and give:[2]: 178 

 

And the variance can be approximated by:[2]: 178, 179 

 
.

The term   is the estimated covariance between the estimated sum of Y and estimated sum of Z. Since this is the covariance of two sums of random variables, it would include many combinations of covariances that will depend on the indicator variables. If the selection probability are uncorrelated (i.e.:  ), this term would still include a summation of n covariances for each element i between   and  . This helps illustrate that this formula incorporates the effect of correlation between y and z on the variance of the ratio estimators.

When defining   the above becomes:[2]: 182 

 

If the selection probability are uncorrelated (i.e.:  ), and when assuming the probability of each element is very small (i.e.:  ), then the above reduced to the following:

 

A similar re-creation of the proof (up to some mistakes at the end) was provided by Thomas Lumley in crossvalidated.[3]

We have (at least) two versions of variance for the weighted mean: one with known and one with unknown population size estimation. There is no uniformly better approach, but the literature presents several arguments to prefer using the population estimation version (even when the population size is known).[2]: 188  For example: if all y values are constant, the estimator with unknown population size will give the correct result, while the one with known population size will have some variability. Also, when the sample size itself is random (e.g.: in Poisson sampling), the version with unknown population mean is considered more stable. Lastly, if the proportion of sampling is negatively correlated with the values (i.e.: smaller chance to sample an observation that is large), then the un-known population size version slightly compensates for that.

For the trivial case in which all the weights are equal to 1, the above formula is just like the regular formula for the variance of the mean (but notice that it uses the maximum likelihood estimator for the variance instead of the unbiased variance. I.e.: dividing it by n instead of (n-1)).

Bootstrapping validation Edit

It has been shown, by Gatz et al. (1995), that in comparison to bootstrapping methods, the following (variance estimation of ratio-mean using Taylor series linearization) is a reasonable estimation for the square of the standard error of the mean (when used in the context of measuring chemical constituents):[4]: 1186 

 

where  . Further simplification leads to

 

Gatz et al. mention that the above formulation was published by Endlich et al. (1988) when treating the weighted mean as a combination of a weighted total estimator divided by an estimator of the population size,[5] based on the formulation published by Cochran (1977), as an approximation to the ratio mean. However, Endlich et al. didn't seem to publish this derivation in their paper (even though they mention they used it), and Cochran's book includes a slightly different formulation.[1]: 155  Still, it's almost identical to the formulations described in previous sections.

Replication-based estimators Edit

Because there is no closed analytical form for the variance of the weighted mean, it was proposed in the literature to rely on replication methods such as the Jackknife and Bootstrapping.[1]: 321 

Other notes Edit

For uncorrelated observations with variances  , the variance of the weighted sample mean is[citation needed]

 

whose square root   can be called the standard error of the weighted mean (general case).[citation needed]

Consequently, if all the observations have equal variance,  , the weighted sample mean will have variance

 

where  . The variance attains its maximum value,  , when all weights except one are zero. Its minimum value is found when all weights are equal (i.e., unweighted mean), in which case we have  , i.e., it degenerates into the standard error of the mean, squared.

Because one can always transform non-normalized weights to normalized weights, all formulas in this section can be adapted to non-normalized weights by replacing all  .

Related concepts Edit

Weighted sample variance Edit

Typically when a mean is calculated it is important to know the variance and standard deviation about that mean. When a weighted mean   is used, the variance of the weighted sample is different from the variance of the unweighted sample.

The biased weighted sample variance   is defined similarly to the normal biased sample variance  :

 

where   for normalized weights. If the weights are frequency weights (and thus are random variables), it can be shown[citation needed] that   is the maximum likelihood estimator of   for iid Gaussian observations.

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.

Frequency weights Edit

If the weights are frequency weights (where a weight equals the number of occurrences), then the unbiased estimator is:

 

This effectively applies Bessel's correction for frequency weights.

For example, if values   are drawn from the same distribution, then we can treat this set as an unweighted sample, or we can treat it as the weighted sample   with corresponding weights  , and we get the same result either way.

If the frequency weights   are normalized to 1, then the correct expression after Bessel's correction becomes

 

where the total number of samples is   (not  ). In any case, the information on total number of samples is necessary in order to obtain an unbiased correction, even if   has a different meaning other than frequency weight.

The estimator can be unbiased only if the weights are not standardized nor normalized, these processes changing the data's mean and variance and thus leading to a loss of the base rate (the population count, which is a requirement for Bessel's correction).

Reliability weights Edit

If the weights are instead non-random (reliability weights[definition needed]), we can determine a correction factor to yield an unbiased estimator. Assuming each random variable is sampled from the same distribution with mean   and actual variance  , taking expectations we have,

 

where   and  . Therefore, the bias in our estimator is  , analogous to the   bias in the unweighted estimator (also notice that   is the effective sample size). This means that to unbias our estimator we need to pre-divide by  , ensuring that the expected value of the estimated variance equals the actual variance of the sampling distribution.

The final unbiased estimate of sample variance is:

 [6]

where  .

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.[7]

Weighted sample covariance Edit

In a weighted sample, each row vector   (each set of single observations on each of the K random variables) is assigned a weight  .

Then the weighted mean vector   is given by

 

And the weighted covariance matrix is given by:[8]

 

Similarly to weighted sample variance, there are two different unbiased estimators depending on the type of the weights.

Frequency weights Edit

If the weights are frequency weights, the unbiased weighted estimate of the covariance matrix  , with Bessel's correction, is given by:[8]

 

This estimator can be unbiased only if the weights are not standardized nor normalized, these processes changing the data's mean and variance and thus leading to a loss of the base rate (the population count, which is a requirement for Bessel's correction).

Reliability weights Edit

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   can be simplified to

 

and the unbiased weighted estimate of the covariance matrix   is:[9]

 

The reasoning here is the same as in the previous section.

Since we are assuming the weights are normalized, then   and this reduces to:

 

If all weights are the same, i.e.  , then the weighted mean and covariance reduce to the unweighted sample mean and covariance above.

Vector-valued estimates Edit

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   by the covariance matrix   and the arithmetic inverse by the matrix inverse (both denoted in the same way, via superscripts); the weight matrix then reads:[10]

 

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 Edit

In the general case, suppose that  ,   is the covariance matrix relating the quantities  ,   is the common mean to be estimated, and   is a design matrix equal to a vector of ones   (of length  ). The Gauss–Markov theorem states that the estimate of the mean having minimum variance is given by:

 

and

 

where:

 

Decreasing strength of interactions Edit

Consider the time series of an independent variable   and a dependent variable  , with   observations sampled at discrete times  . In many common situations, the value of   at time   depends not only on   but also on its past values. Commonly, the strength of this dependence decreases as the separation of observations in time increases. To model this situation, one may replace the independent variable by its sliding mean   for a window size  .

 

Exponentially decreasing weights Edit

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   at each time step. Setting   we can define   normalized weights by

 

where   is the sum of the unnormalized weights. In this case   is simply

 

approaching   for large values of  .

The damping constant   must correspond to the actual decrease of interaction strength. If this cannot be determined from theoretical considerations, then the following properties of exponentially decreasing weights are useful in making a suitable choice: at step  , the weight approximately equals  , the tail area the value  , the head area  . The tail area at step   is  . Where primarily the closest   observations matter and the effect of the remaining observations can be ignored safely, then choose   such that the tail area is sufficiently small.

Weighted averages of functions Edit

The concept of weighted average can be extended to functions.[11] Weighted averages of functions play an important role in the systems of weighted differential and integral calculus.[12]

Correcting for over- or under-dispersion Edit

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   is too large. The correction that must be made is

 

where   is the reduced chi-squared:

 

The square root   can be called the standard error of the weighted mean (variance weights, scale corrected).

When all data variances are equal,  , they cancel out in the weighted mean variance,

weighted, arithmetic, mean, weighted, average, redirects, here, confused, with, weighted, median, weighted, geometric, mean, weighted, harmonic, mean, weighted, arithmetic, mean, similar, ordinary, arithmetic, mean, most, common, type, average, except, that, i. Weighted average redirects here Not to be confused with Weighted median Weighted geometric mean or Weighted harmonic mean 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 Contents 1 Examples 1 1 Basic example 1 2 Convex combination example 2 Mathematical definition 2 1 Variance defined weights 3 Statistical properties 3 1 Expectancy 3 2 Variance 3 2 1 Simple i i d case 3 2 2 Survey sampling perspective 3 2 3 Variance of the weighted sum pwr estimator for totals 3 2 4 Variance of the weighted mean p estimator for ratio mean 3 2 5 Bootstrapping validation 3 2 6 Replication based estimators 3 2 7 Other notes 4 Related concepts 4 1 Weighted sample variance 4 1 1 Frequency weights 4 1 2 Reliability weights 4 2 Weighted sample covariance 4 2 1 Frequency weights 4 2 2 Reliability weights 4 3 Vector valued estimates 4 4 Accounting for correlations 4 5 Decreasing strength of interactions 4 6 Exponentially decreasing weights 4 7 Weighted averages of functions 4 8 Correcting for over or under dispersion 5 See also 6 Notes 7 References 8 Further reading 9 External linksExamples EditBasic example Edit 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 nbsp 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 nbsp 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 Edit 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 nbsp 30 20 30 0 6 displaystyle frac 30 20 30 0 6 nbsp 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 nbsp Mathematical definition EditFormally 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 nbsp with corresponding non negative weights w 1 w 2 w n displaystyle left w 1 w 2 dots w n right nbsp 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 nbsp 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 nbsp 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 a 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 nbsp 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 nbsp 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 nbsp The ordinary mean 1 n i 1 n x i textstyle frac 1 n sum limits i 1 n x i nbsp 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 s 2 displaystyle sigma 2 nbsp the standard error of the weighted mean s x displaystyle sigma bar x nbsp can be shown via uncertainty propagation to be s x s i 1 n w i 2 textstyle sigma bar x sigma sqrt sum limits i 1 n w i 2 nbsp Variance defined weights Edit Main article Inverse variance weighting See also Weighted least squares For the weighted mean of a list of data for which each element x i displaystyle x i nbsp potentially comes from a different probability distribution with known variance s i 2 displaystyle sigma i 2 nbsp all having the same mean one possible choice for the weights is given by the reciprocal of variance w i 1 s i 2 displaystyle w i frac 1 sigma i 2 nbsp The weighted mean in this case is x i 1 n x i s i 2 i 1 n 1 s 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 nbsp and the standard error of the weighted mean with inverse variance weights is s x 1 i 1 n s 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 nbsp Note this reduces to s x 2 s 0 2 n displaystyle sigma bar x 2 sigma 0 2 n nbsp when all s i s 0 displaystyle sigma i sigma 0 nbsp It is a special case of the general formula in previous section s x 2 i 1 n w i 2 s i 2 i 1 n s i 4 s i 2 i 1 n s 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 nbsp The equations above can be combined to obtain x s x 2 i 1 n x i s i 2 displaystyle bar x sigma bar x 2 sum i 1 n frac x i sigma i 2 nbsp 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 EditExpectancy Edit The weighted sample mean x displaystyle bar x nbsp 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 valuesE x i m i displaystyle E x i mu i nbsp then the weighted sample mean has expectation E x i 1 n w i m i displaystyle E bar x sum i 1 n w i mu i nbsp In particular if the means are equal m i m displaystyle mu i mu nbsp then the expectation of the weighted sample mean will be that value E x m displaystyle E bar x mu nbsp Variance Edit Simple i i d case Edit 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 s y 2 n w 2 w 2 displaystyle operatorname Var bar y w frac hat sigma y 2 n frac overline w 2 bar w 2 nbsp With s 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 nbsp w i 1 n w i n displaystyle bar w frac sum i 1 n w i n nbsp and w 2 i 1 n w i 2 n displaystyle overline w 2 frac sum i 1 n w i 2 n nbsp 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 Edit From a model based perspective we are interested in estimating the variance of the weighted mean when the different y i displaystyle y i nbsp 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 1 306 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 nbsp or estimated N displaystyle hat N nbsp 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 nbsp 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 p i displaystyle P I i 1 mid text Some sample of size n pi i nbsp and the one draw probability of selection is P I i 1 one sample draw p i p i n displaystyle P I i 1 text one sample draw p i approx frac pi i n nbsp If N is very large and each p i displaystyle p i nbsp is very small For the following derivation we ll assume that the probability of selecting each element is fully represented by these probabilities 2 42 43 51 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 nbsp is fixed and the randomness comes from it being included in the sample or not I i displaystyle I i nbsp 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 nbsp With the following expectancy E y i y i E I i y i p i displaystyle E y i y i E I i y i pi i nbsp and variance V y i y i 2 V I i y i 2 p i 1 p i displaystyle V y i y i 2 V I i y i 2 pi i 1 pi i nbsp When each element of the sample is inflated by the inverse of its selection probability it is termed the p displaystyle pi nbsp expanded y values i e y ˇ i y i p i displaystyle check y i frac y i pi i nbsp A related quantity is p displaystyle p nbsp expanded y values y i p i n y ˇ i displaystyle frac y i p i n check y i nbsp 2 42 43 51 52 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 p i displaystyle check y i I i check y i frac I i y i pi i nbsp 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 p i 1 n p i displaystyle w i frac 1 pi i approx frac 1 n times p i nbsp Variance of the weighted sum pwr estimator for totals Edit 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 nbsp 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 nbsp Proof The general formula can be developed like this Y known N Y p w r N 1 n i 1 n y i p i N i 1 n y i p i N i 1 n w i y i N displaystyle hat bar Y text known N frac hat Y pwr N frac frac 1 n sum i 1 n frac y i p i N approx frac sum i 1 n frac y i pi i N frac sum i 1 n w i y i N nbsp The population total is denoted as Y i 1 N y i displaystyle Y sum i 1 N y i nbsp and it may be estimated by the unbiased Horvitz Thompson estimator also called the p displaystyle pi nbsp estimator This estimator can be itself estimated using the pwr estimator i e p displaystyle p nbsp expanded with replacement estimator or probability with replacement estimator With the above notation it is Y p w r 1 n i 1 n y i p i i 1 n y i n p i i 1 n y i p i i 1 n w i y i displaystyle hat Y pwr frac 1 n sum i 1 n frac y i p i sum i 1 n frac y i np i approx sum i 1 n frac y i pi i sum i 1 n w i y i nbsp 2 51 The estimated variance of the pwr estimator is given by 2 52 Var Y p w r n n 1 i 1 n w i y i w y 2 displaystyle operatorname Var hat Y pwr frac n n 1 sum i 1 n left w i y i overline wy right 2 nbsp where w y i 1 n w i y i n displaystyle overline wy sum i 1 n frac w i y i n nbsp The above formula was taken from Sarndal et al 1992 also presented in Cochran 1977 but was written differently 2 52 1 307 11 35 The left side is how the variance was written and the right side is how we ve developed the weighted version Var Y pwr 1 n 1 n 1 i 1 n y i p i Y p w r 2 1 n 1 n 1 i 1 n n n y i p i n n i 1 n w i y i 2 1 n 1 n 1 i 1 n n y i p i n i 1 n w i y i n 2 n 2 n 1 n 1 i 1 n w i y i w y 2 n n 1 i 1 n w i y i w y 2 displaystyle begin aligned operatorname Var hat Y text pwr amp frac 1 n frac 1 n 1 sum i 1 n left frac y i p i hat Y pwr right 2 amp frac 1 n frac 1 n 1 sum i 1 n left frac n n frac y i p i frac n n sum i 1 n w i y i right 2 frac 1 n frac 1 n 1 sum i 1 n left n frac y i pi i n frac sum i 1 n w i y i n right 2 amp frac n 2 n frac 1 n 1 sum i 1 n left w i y i overline wy right 2 amp frac n n 1 sum i 1 n left w i y i overline wy right 2 end aligned nbsp And we got to the formula from above An alternative term for when the sampling has a random sample size as in Poisson sampling is presented in Sarndal et al 1992 as 2 182 Var Y pwr known N 1 N 2 i 1 n j 1 n D ˇ 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 nbsp With y ˇ i y i p i displaystyle check y i frac y i pi i nbsp Also C I i I j p i j p i p j D i j displaystyle C I i I j pi ij pi i pi j Delta ij nbsp where p i j displaystyle pi ij nbsp is the probability of selecting both i and j 2 36 And D ˇ i j 1 p i p j p i j displaystyle check Delta ij 1 frac pi i pi j pi ij nbsp and for i j D ˇ i i 1 p i p i p i 1 p i displaystyle check Delta ii 1 frac pi i pi i pi i 1 pi i nbsp 2 43 If the selection probability are uncorrelated i e i j C I i I j 0 displaystyle forall i neq j C I i I j 0 nbsp and when assuming the probability of each element is very small then Var Y pwr known N 1 N 2 i 1 n w i y i 2 displaystyle operatorname Var hat bar Y text pwr known N text frac 1 N 2 sum i 1 n left w i y i right 2 nbsp Proof We assume that 1 p i 1 displaystyle 1 pi i approx 1 nbsp and thatVar Y pwr known N 1 N 2 i 1 n j 1 n D ˇ i j y ˇ i y ˇ j 1 N 2 i 1 n D ˇ i i y ˇ i y ˇ i 1 N 2 i 1 n 1 p i y i p i y i p i 1 N 2 i 1 n w i y i 2 displaystyle begin aligned operatorname Var hat Y text pwr known N text amp frac 1 N 2 sum i 1 n sum j 1 n left check Delta ij check y i check y j right amp frac 1 N 2 sum i 1 n left check Delta ii check y i check y i right amp frac 1 N 2 sum i 1 n left 1 pi i frac y i pi i frac y i pi i right amp frac 1 N 2 sum i 1 n left w i y i right 2 end aligned nbsp Variance of the weighted mean p estimator for ratio mean Edit The previous section dealt with estimating the population mean as a ratio of an estimated population total Y displaystyle hat Y nbsp with a known population size N displaystyle N nbsp and the variance was estimated in that context Another common case is that the population size itself N displaystyle N nbsp is unknown and is estimated using the sample i e N displaystyle hat N nbsp The estimation of N displaystyle N nbsp can be described as the sum of weights So when w i 1 p i displaystyle w i frac 1 pi i nbsp we get N i 1 n w i I i i 1 n I i p i i 1 n 1 ˇ i displaystyle hat N sum i 1 n w i I i sum i 1 n frac I i pi i sum i 1 n check 1 i nbsp With the above notation the parameter we care about is the ratio of the sums of y i displaystyle y i nbsp s and 1s I e R Y i 1 N y i p i i 1 N 1 p i i 1 N y ˇ i i 1 N 1 ˇ i i 1 N w i y i i 1 N w i displaystyle R bar Y frac sum i 1 N frac y i pi i sum i 1 N frac 1 pi i frac sum i 1 N check y i sum i 1 N check 1 i frac sum i 1 N w i y i sum i 1 N w i nbsp We can estimate it using our sample with R Y i 1 N I i y i p i i 1 N I i 1 p i i 1 N y ˇ i i 1 N 1 ˇ i i 1 N w i y i i 1 N w i 1 i i 1 n w i y i i 1 n w i 1 i y w displaystyle hat R hat bar Y frac sum i 1 N I i frac y i pi i sum i 1 N I i frac 1 pi i frac sum i 1 N check y i sum i 1 N check 1 i frac sum i 1 N w i y i sum i 1 N w i 1 i frac sum i 1 n w i y i sum i 1 n w i 1 i bar y w nbsp As we moved from using N to using n we actually know that all the indicator variables get 1 so we could simply write y w i 1 n w i y i i 1 n w i displaystyle bar y w frac sum i 1 n w i y i sum i 1 n w i nbsp This will be the estimand for specific values of y and w but the statistical properties comes when including the indicator variable y w i 1 n w i y i i 1 n w i 1 i displaystyle bar y w frac sum i 1 n w i y i sum i 1 n w i 1 i nbsp 2 162 163 176 This is called a Ratio estimator and it is approximately unbiased for R 2 182 In this case the variability of the ratio depends on the variability of the random variables both in the numerator and the denominator as well as their correlation Since there is no closed analytical form to compute this variance various methods are used for approximate estimation Primarily Taylor series first order linearization asymptotics and bootstrap jackknife 2 172 The Taylor linearization method could lead to under estimation of the variance for small sample sizes in general but that depends on the complexity of the statistic For the weighted mean the approximate variance is supposed to be relatively accurate even for medium sample sizes 2 176 For when the sampling has a random sample size as in Poisson sampling it is as follows 2 182 V y w 1 i 1 n w i 2 i 1 n w i 2 y i y w 2 displaystyle widehat V bar y w frac 1 sum i 1 n w i 2 sum i 1 n w i 2 y i bar y w 2 nbsp If p i p i n displaystyle pi i approx p i n nbsp then either using w i 1 p i displaystyle w i frac 1 pi i nbsp or w i 1 p i displaystyle w i frac 1 p i nbsp would give the same estimator since multiplying w i displaystyle w i nbsp by some factor would lead to the same estimator It also means that if we scale the sum of weights to be equal to a known from before population size N the variance calculation would look the same When all weights are equal to one another this formula is reduced to the standard unbiased variance estimator Proof The Taylor linearization states that for a general ratio estimator of two sums R Y Z displaystyle hat R frac hat Y hat Z nbsp they can be expanded around the true value R and give 2 178 R Y Z i 1 n w i y i i 1 n w i z i R 1 Z i 1 n y i p i R z i p i displaystyle hat R frac hat Y hat Z frac sum i 1 n w i y i sum i 1 n w i z i approx R frac 1 Z sum i 1 n left frac y i pi i R frac z i pi i right nbsp And the variance can be approximated by 2 178 179 V R 1 Z 2 i 1 n j 1 n D ˇ i j y i R z i p i y j R z j p j 1 Z 2 V Y R V Z 2 R C Y Z displaystyle widehat V hat R frac 1 hat Z 2 sum i 1 n sum j 1 n left check Delta ij frac y i hat R z i pi i frac y j hat R z j pi j right frac 1 hat Z 2 left widehat V hat Y hat R widehat V hat Z 2 hat R hat C hat Y hat Z right nbsp The term C Y Z displaystyle hat C hat Y hat Z nbsp is the estimated covariance between the estimated sum of Y and estimated sum of Z Since this is the covariance of two sums of random variables it would include many combinations of covariances that will depend on the indicator variables If the selection probability are uncorrelated i e i j D i j C I i I j 0 displaystyle forall i neq j Delta ij C I i I j 0 nbsp this term would still include a summation of n covariances for each element i between y i I i y i displaystyle y i I i y i nbsp and z i I i z i displaystyle z i I i z i nbsp This helps illustrate that this formula incorporates the effect of correlation between y and z on the variance of the ratio estimators When defining z i 1 displaystyle z i 1 nbsp the above becomes 2 182 V R V y w 1 N 2 i 1 n j 1 n D ˇ i j y i y w p i y j y w p j displaystyle widehat V hat R widehat V bar y w frac 1 hat N 2 sum i 1 n sum j 1 n left check Delta ij frac y i bar y w pi i frac y j bar y w pi j right nbsp If the selection probability are uncorrelated i e i j D i j C I i I j 0 displaystyle forall i neq j Delta ij C I i I j 0 nbsp and when assuming the probability of each element is very small i e 1 p i 1 displaystyle 1 pi i approx 1 nbsp then the above reduced to the following V y w 1 N 2 i 1 n 1 p i y i y w p i 2 1 i 1 n w i 2 i 1 n w i 2 y i y w 2 displaystyle widehat V bar y w frac 1 hat N 2 sum i 1 n left 1 pi i frac y i bar y w pi i right 2 frac 1 sum i 1 n w i 2 sum i 1 n w i 2 y i bar y w 2 nbsp A similar re creation of the proof up to some mistakes at the end was provided by Thomas Lumley in crossvalidated 3 We have at least two versions of variance for the weighted mean one with known and one with unknown population size estimation There is no uniformly better approach but the literature presents several arguments to prefer using the population estimation version even when the population size is known 2 188 For example if all y values are constant the estimator with unknown population size will give the correct result while the one with known population size will have some variability Also when the sample size itself is random e g in Poisson sampling the version with unknown population mean is considered more stable Lastly if the proportion of sampling is negatively correlated with the values i e smaller chance to sample an observation that is large then the un known population size version slightly compensates for that For the trivial case in which all the weights are equal to 1 the above formula is just like the regular formula for the variance of the mean but notice that it uses the maximum likelihood estimator for the variance instead of the unbiased variance I e dividing it by n instead of n 1 Bootstrapping validation Edit It has been shown by Gatz et al 1995 that in comparison to bootstrapping methods the following variance estimation of ratio mean using Taylor series linearization is a reasonable estimation for the square of the standard error of the mean when used in the context of measuring chemical constituents 4 1186 s x w 2 n n 1 n w 2 w i x i w x w 2 2 x w w i w w i x i w x w x w 2 w i w 2 displaystyle widehat sigma bar x w 2 frac n n 1 n bar w 2 left sum w i x i bar w bar x w 2 2 bar x w sum w i bar w w i x i bar w bar x w bar x w 2 sum w i bar w 2 right nbsp where w w i n displaystyle bar w frac sum w i n nbsp Further simplification leads to s x 2 n n 1 n w 2 w i 2 x i x w 2 displaystyle widehat sigma bar x 2 frac n n 1 n bar w 2 sum w i 2 x i bar x w 2 nbsp Gatz et al mention that the above formulation was published by Endlich et al 1988 when treating the weighted mean as a combination of a weighted total estimator divided by an estimator of the population size 5 based on the formulation published by Cochran 1977 as an approximation to the ratio mean However Endlich et al didn t seem to publish this derivation in their paper even though they mention they used it and Cochran s book includes a slightly different formulation 1 155 Still it s almost identical to the formulations described in previous sections Replication based estimators Edit Because there is no closed analytical form for the variance of the weighted mean it was proposed in the literature to rely on replication methods such as the Jackknife and Bootstrapping 1 321 Other notes Edit For uncorrelated observations with variances s i 2 displaystyle sigma i 2 nbsp the variance of the weighted sample mean is citation needed s x 2 i 1 n w i 2 s i 2 displaystyle sigma bar x 2 sum i 1 n w i 2 sigma i 2 nbsp whose square root s x displaystyle sigma bar x nbsp can be called the standard error of the weighted mean general case citation needed Consequently if all the observations have equal variance s i 2 s 0 2 displaystyle sigma i 2 sigma 0 2 nbsp the weighted sample mean will have variance s x 2 s 0 2 i 1 n w i 2 displaystyle sigma bar x 2 sigma 0 2 sum i 1 n w i 2 nbsp where 1 n i 1 n w i 2 1 textstyle 1 n leq sum i 1 n w i 2 leq 1 nbsp The variance attains its maximum value s 0 2 displaystyle sigma 0 2 nbsp when all weights except one are zero Its minimum value is found when all weights are equal i e unweighted mean in which case we have s x s 0 n textstyle sigma bar x sigma 0 sqrt n nbsp i e it degenerates into the standard error of the mean squared Because one can always transform non normalized weights to normalized weights all formulas in this section can be adapted to non normalized weights by replacing all w i w i i 1 n w i displaystyle w i frac w i sum i 1 n w i nbsp Related concepts EditWeighted sample variance Edit See also Correcting for over or under dispersion Typically when a mean is calculated it is important to know the variance and standard deviation about that mean When a weighted mean m displaystyle mu nbsp is used the variance of the weighted sample is different from the variance of the unweighted sample The biased weighted sample variance s w 2 displaystyle hat sigma mathrm w 2 nbsp is defined similarly to the normal biased sample variance s 2 displaystyle hat sigma 2 nbsp s 2 i 1 N x i m 2 N s w 2 i 1 N w i x i m 2 i 1 N w i displaystyle begin aligned hat sigma 2 amp frac sum limits i 1 N left x i mu right 2 N hat sigma mathrm w 2 amp frac sum limits i 1 N w i left x i mu right 2 sum i 1 N w i end aligned nbsp where i 1 N w i 1 displaystyle sum i 1 N w i 1 nbsp for normalized weights If the weights are frequency weights and thus are random variables it can be shown citation needed that s w 2 displaystyle hat sigma mathrm w 2 nbsp is the maximum likelihood estimator of s 2 displaystyle sigma 2 nbsp for iid Gaussian observations 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 Frequency weights Edit If the weights are frequency weights where a weight equals the number of occurrences then the unbiased estimator is s 2 i 1 N w i x i m 2 i 1 N w i 1 displaystyle s 2 frac sum limits i 1 N w i left x i mu right 2 sum i 1 N w i 1 nbsp This effectively applies Bessel s correction for frequency weights For example if values 2 2 4 5 5 5 displaystyle 2 2 4 5 5 5 nbsp are drawn from the same distribution then we can treat this set as an unweighted sample or we can treat it as the weighted sample 2 4 5 displaystyle 2 4 5 nbsp with corresponding weights 2 1 3 displaystyle 2 1 3 nbsp and we get the same result either way If the frequency weights w i displaystyle w i nbsp are normalized to 1 then the correct expression after Bessel s correction becomes s 2 i 1 N w i i 1 N w i 1 i 1 N w i x i m 2 displaystyle s 2 frac sum i 1 N w i sum i 1 N w i 1 sum i 1 N w i left x i mu right 2 nbsp where the total number of samples is i 1 N w i displaystyle sum i 1 N w i nbsp not N displaystyle N nbsp In any case the information on total number of samples is necessary in order to obtain an unbiased correction even if w i displaystyle w i nbsp has a different meaning other than frequency weight The estimator can be unbiased only if the weights are not standardized nor normalized these processes changing the data s mean and variance and thus leading to a loss of the base rate the population count which is a requirement for Bessel s correction Reliability weights Edit If the weights are instead non random reliability weights definition needed we can determine a correction factor to yield an unbiased estimator Assuming each random variable is sampled from the same distribution with mean m displaystyle mu nbsp and actual variance s actual 2 displaystyle sigma text actual 2 nbsp taking expectations we have E s 2 i 1 N E x i m 2 N E X E X 2 1 N E X E X 2 N 1 N s actual 2 E s w 2 i 1 N w i E x i m 2 V 1 E X E X 2 V 2 V 1 2 E X E X 2 1 V 2 V 1 2 s actual 2 displaystyle begin aligned operatorname E hat sigma 2 amp frac sum limits i 1 N operatorname E x i mu 2 N amp operatorname E X operatorname E X 2 frac 1 N operatorname E X operatorname E X 2 amp left frac N 1 N right sigma text actual 2 operatorname E hat sigma mathrm w 2 amp frac sum limits i 1 N w i operatorname E x i mu 2 V 1 amp operatorname E X operatorname E X 2 frac V 2 V 1 2 operatorname E X operatorname E X 2 amp left 1 frac V 2 V 1 2 right sigma text actual 2 end aligned nbsp where V 1 i 1 N w i displaystyle V 1 sum i 1 N w i nbsp and V 2 i 1 N w i 2 displaystyle V 2 sum i 1 N w i 2 nbsp Therefore the bias in our estimator is 1 V 2 V 1 2 displaystyle left 1 frac V 2 V 1 2 right nbsp analogous to the N 1 N displaystyle left frac N 1 N right nbsp bias in the unweighted estimator also notice that V 1 2 V 2 N e f f displaystyle V 1 2 V 2 N eff nbsp is the effective sample size This means that to unbias our estimator we need to pre divide by 1 V 2 V 1 2 displaystyle 1 left V 2 V 1 2 right nbsp ensuring that the expected value of the estimated variance equals the actual variance of the sampling distribution The final unbiased estimate of sample variance is s w 2 s w 2 1 V 2 V 1 2 i 1 N w i x i m 2 V 1 V 2 V 1 displaystyle begin aligned s mathrm w 2 amp frac hat sigma mathrm w 2 1 V 2 V 1 2 4pt amp frac sum limits i 1 N w i x i mu 2 V 1 V 2 V 1 end aligned nbsp 6 where E s w 2 s actual 2 displaystyle operatorname E s mathrm w 2 sigma text actual 2 nbsp 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 7 Weighted sample covariance Edit In a weighted sample each row vector x i displaystyle mathbf x i nbsp each set of single observations on each of the K random variables is assigned a weight w i 0 displaystyle w i geq 0 nbsp Then the weighted mean vector m displaystyle mathbf mu nbsp is given by m i 1 N w i x i i 1 N w i displaystyle mathbf mu frac sum i 1 N w i mathbf x i sum i 1 N w i nbsp And the weighted covariance matrix is given by 8 C i 1 N w i x i m T x i m V 1 displaystyle mathbf C frac sum i 1 N w i left mathbf x i mu right T left mathbf x i mu right V 1 nbsp Similarly to weighted sample variance there are two different unbiased estimators depending on the type of the weights Frequency weights Edit If the weights are frequency weights the unbiased weighted estimate of the covariance matrix C displaystyle textstyle mathbf C nbsp with Bessel s correction is given by 8 C i 1 N w i x i m T x i m V 1 1 displaystyle mathbf C frac sum i 1 N w i left mathbf x i mu right T left mathbf x i mu right V 1 1 nbsp This estimator can be unbiased only if the weights are not standardized nor normalized these processes changing the data s mean and variance and thus leading to a loss of the base rate the population count which is a requirement for Bessel s correction Reliability weights Edit In the case of reliability weights the weights are normalized V 1 i 1 N w i 1 displaystyle V 1 sum i 1 N w i 1 nbsp If they are not divide the weights by their sum to normalize prior to calculating V 1 displaystyle V 1 nbsp w i w i i 1 N w i displaystyle w i frac w i sum i 1 N w i nbsp Then the weighted mean vector m displaystyle mathbf mu nbsp can be simplified to m i 1 N w i x i displaystyle mathbf mu sum i 1 N w i mathbf x i nbsp and the unbiased weighted estimate of the covariance matrix C displaystyle mathbf C nbsp is 9 C i 1 N w i i 1 N w i 2 i 1 N w i 2 i 1 N w i x i m T x i m i 1 N w i x i m T x i m V 1 V 2 V 1 displaystyle begin aligned mathbf C amp frac sum i 1 N w i left sum i 1 N w i right 2 sum i 1 N w i 2 sum i 1 N w i left mathbf x i mu right T left mathbf x i mu right amp frac sum i 1 N w i left mathbf x i mu right T left mathbf x i mu right V 1 V 2 V 1 end aligned nbsp The reasoning here is the same as in the previous section Since we are assuming the weights are normalized then V 1 1 displaystyle V 1 1 nbsp and this reduces to C i 1 N w i x i m T x i m 1 V 2 displaystyle mathbf C frac sum i 1 N w i left mathbf x i mu right T left mathbf x i mu right 1 V 2 nbsp If all weights are the same i e w i V 1 1 N displaystyle w i V 1 1 N nbsp then the weighted mean and covariance reduce to the unweighted sample mean and covariance above Vector valued estimates Edit 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 s 2 displaystyle sigma 2 nbsp by the covariance matrix C displaystyle mathbf C nbsp and the arithmetic inverse by the matrix inverse both denoted in the same way via superscripts the weight matrix then reads 10 W i C i 1 displaystyle mathbf W i mathbf C i 1 nbsp The weighted mean in this case is x C x i 1 n W i x i displaystyle bar mathbf x mathbf C bar mathbf x left sum i 1 n mathbf W i mathbf x i right nbsp where the order of the matrix vector product is not commutative in terms of the covariance of the weighted mean C x i 1 n W i 1 displaystyle mathbf C bar mathbf x left sum i 1 n mathbf W i right 1 nbsp 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 x 1 1 0 C 1 1 0 0 100 displaystyle mathbf x 1 begin bmatrix 1 amp 0 end bmatrix top qquad mathbf C 1 begin bmatrix 1 amp 0 0 amp 100 end bmatrix nbsp x 2 0 1 C 2 100 0 0 1 displaystyle mathbf x 2 begin bmatrix 0 amp 1 end bmatrix top qquad mathbf C 2 begin bmatrix 100 amp 0 0 amp 1 end bmatrix nbsp then the weighted mean is x C 1 1 C 2 1 1 C 1 1 x 1 C 2 1 x 2 0 9901 0 0 0 9901 1 1 0 9901 0 9901 displaystyle begin aligned bar mathbf x amp left mathbf C 1 1 mathbf C 2 1 right 1 left mathbf C 1 1 mathbf x 1 mathbf C 2 1 mathbf x 2 right 5pt amp begin bmatrix 0 9901 amp 0 0 amp 0 9901 end bmatrix begin bmatrix 1 1 end bmatrix begin bmatrix 0 9901 0 9901 end bmatrix end aligned nbsp 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 Edit See also Generalized least squares and Variance Sum of correlated variables In the general case suppose that X x 1 x n T displaystyle mathbf X x 1 dots x n T nbsp C displaystyle mathbf C nbsp is the covariance matrix relating the quantities x i displaystyle x i nbsp x displaystyle bar x nbsp is the common mean to be estimated and J displaystyle mathbf J nbsp is a design matrix equal to a vector of ones 1 1 T displaystyle 1 dots 1 T nbsp of length n displaystyle n nbsp The Gauss Markov theorem states that the estimate of the mean having minimum variance is given by s x 2 J T W J 1 displaystyle sigma bar x 2 mathbf J T mathbf W mathbf J 1 nbsp and x s x 2 J T W X displaystyle bar x sigma bar x 2 mathbf J T mathbf W mathbf X nbsp where W C 1 displaystyle mathbf W mathbf C 1 nbsp Decreasing strength of interactions Edit Consider the time series of an independent variable x displaystyle x nbsp and a dependent variable y displaystyle y nbsp with n displaystyle n nbsp observations sampled at discrete times t i displaystyle t i nbsp In many common situations the value of y displaystyle y nbsp at time t i displaystyle t i nbsp depends not only on x i displaystyle x i nbsp but also on its past values Commonly the strength of this dependence decreases as the separation of observations in time increases To model this situation one may replace the independent variable by its sliding mean z displaystyle z nbsp for a window size m displaystyle m nbsp z k i 1 m w i x k 1 i displaystyle z k sum i 1 m w i x k 1 i nbsp Exponentially decreasing weights Edit See also Exponentially weighted moving average 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 0 lt D lt 1 displaystyle 0 lt Delta lt 1 nbsp at each time step Setting w 1 D displaystyle w 1 Delta nbsp we can define m displaystyle m nbsp normalized weights by w i w i 1 V 1 displaystyle w i frac w i 1 V 1 nbsp where V 1 displaystyle V 1 nbsp is the sum of the unnormalized weights In this case V 1 displaystyle V 1 nbsp is simply V 1 i 1 m w i 1 1 w m 1 w displaystyle V 1 sum i 1 m w i 1 frac 1 w m 1 w nbsp approaching V 1 1 1 w displaystyle V 1 1 1 w nbsp for large values of m displaystyle m nbsp The damping constant w displaystyle w nbsp must correspond to the actual decrease of interaction strength If this cannot be determined from theoretical considerations then the following properties of exponentially decreasing weights are useful in making a suitable choice at step 1 w 1 displaystyle 1 w 1 nbsp the weight approximately equals e 1 1 w 0 39 1 w displaystyle e 1 1 w 0 39 1 w nbsp the tail area the value e 1 displaystyle e 1 nbsp the head area 1 e 1 0 61 displaystyle 1 e 1 0 61 nbsp The tail area at step n displaystyle n nbsp is e n 1 w displaystyle leq e n 1 w nbsp Where primarily the closest n displaystyle n nbsp observations matter and the effect of the remaining observations can be ignored safely then choose w displaystyle w nbsp such that the tail area is sufficiently small Weighted averages of functions Edit The concept of weighted average can be extended to functions 11 Weighted averages of functions play an important role in the systems of weighted differential and integral calculus 12 Correcting for over or under dispersion Edit See also Weighted sample variance 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 x 2 displaystyle chi 2 nbsp is too large The correction that must be made is s x 2 s x 2 x n 2 displaystyle hat sigma bar x 2 sigma bar x 2 chi nu 2 nbsp where x n 2 displaystyle chi nu 2 nbsp is the reduced chi squared x n 2 1 n 1 i 1 n x i x 2 s i 2 displaystyle chi nu 2 frac 1 n 1 sum i 1 n frac x i bar x 2 sigma i 2 nbsp The square root s x displaystyle hat sigma bar x nbsp can be called the standard error of the weighted mean variance weights scale corrected When all data variances are equal s i s 0 displaystyle sigma i sigma 0 nbsp they cancel out in the weighted mean variance s x, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.