Tutorials › Survey Sampling › Weighted Variance and Standard Deviation

Weighted Descriptive Analysis · Tutorial 708 of 998

Weighted Variance and Standard Deviation

Calculate weighted variance and standard deviation from survey data, and interpret their units without confusing descriptive spread with sampling uncertainty.

Intermediate 10 min read

What You'll Learn

  • Define weighted population variance and standard deviation for a survey distribution
  • Calculate weighted spread using either squared deviations or weighted moments
  • Work with both frequency weights and survey expansion weights
  • Interpret variance in squared units and standard deviation in the original units
  • Distinguish descriptive spread from the design-based standard error of an estimated mean
  • Recognize why the usual sample-variance correction does not apply to this descriptive calculation

Why Weighted Spread Matters

A weighted mean describes a survey distribution’s center, but it does not describe how widely its values vary. Two populations can have the same mean and very different distributions: one may cluster close to the mean, while another may contain many low and high values. A measure of spread helps describe that difference.

In survey analysis, each responding unit can represent a different amount of the target population. The weighted variance therefore gives more influence to values that represent more population members. It is a descriptive summary of the weighted distribution. It is not, by itself, a measure of how precisely a survey has estimated the population mean.

Definition: Suppose the eligible records have values \(x_i\) and nonnegative survey weights \(w_i\), for \(i=1,\ldots,n\), with total weight \(W=\sum_{i=1}^{n}w_i>0\). The weighted mean is \(\bar{x}_w=\sum_{i=1}^{n}w_i x_i/W\). The weighted population variance and standard deviation are $$ \widehat{\sigma}^{\,2}_w = \frac{\sum_{i=1}^{n} w_i(x_i-\bar{x}_w)^2}{W}, \qquad \widehat{\sigma}_w = \sqrt{\widehat{\sigma}^{\,2}_w}. $$ The variance is expressed in squared units of \(x\); the standard deviation is expressed in the same units as \(x\).

The notation \(\widehat{\sigma}^{\,2}_w\) emphasizes that the weighted distribution is usually calculated from survey records and used to describe a target population. If the data instead enumerate every member of a population, with weights representing the number of population members at each value, the same calculation gives that population’s variance exactly. With a sample and survey weights, it is a weighted descriptive estimate; its accuracy depends on the survey design and the suitability of the weights.

Two Equivalent Calculation Forms

The defining formula uses squared deviations from the weighted mean. A second form uses weighted first and second moments. It can be convenient when a table already reports weighted totals of \(x_i\) and \(x_i^2\).

Equivalent formula: If \(W>0\), then $$ \widehat{\sigma}^{\,2}_w = \frac{\sum_{i=1}^{n} w_i x_i^2}{W} - \left(\frac{\sum_{i=1}^{n} w_i x_i}{W}\right)^2. $$ This is the weighted mean of the squared values minus the square of the weighted mean.

To justify the identity, write each squared deviation as \(x_i^2-2x_i\bar{x}_w+\bar{x}_w^2\), multiply by \(w_i\), and sum. Dividing by \(W\) gives

$$ \begin{aligned} \frac{\sum_i w_i(x_i-\bar{x}_w)^2}{W} &= \frac{\sum_i w_i x_i^2}{W} - 2\bar{x}_w\frac{\sum_i w_i x_i}{W} + \bar{x}_w^2\frac{\sum_i w_i}{W}\\ &= \frac{\sum_i w_i x_i^2}{W} - 2\bar{x}_w^2+\bar{x}_w^2\\ &= \frac{\sum_i w_i x_i^2}{W}-\bar{x}_w^2. \end{aligned} $$

The second equality uses \(\sum_i w_i x_i/W=\bar{x}_w\) and \(\sum_i w_i/W=1\). Substituting the weighted-mean formula for \(\bar{x}_w\) gives the stated equivalent formula. In practice, either form should use unrounded totals and means until the final result is reported.

Worked Example: A Weighted Distribution With Integer Frequencies

Suppose a hypothetical distribution records a test score \(x_i\) and the number \(w_i\) of population members with that score. The scores are 0, 2, and 4 points, with frequencies 1, 3, and 2. Find the weighted mean, variance, and standard deviation. Because the weights are population frequencies, this calculation describes the full distribution represented by the table.

The total frequency is \(W=1+3+2=6\). The weighted mean is

$$ \bar{x}_w = \frac{1(0)+3(2)+2(4)}{6} = \frac{14}{6} = \frac{7}{3} \approx 2.333\text{ points}. $$

Using the squared-deviation definition,

$$ \begin{aligned} \widehat{\sigma}^{\,2}_w &= \frac{1(0-7/3)^2+3(2-7/3)^2+2(4-7/3)^2}{6}\\ &= \frac{49/9+3(1/9)+2(25/9)}{6}\\ &= \frac{102/9}{6} = \frac{17}{9} \approx 1.889\text{ points}^2. \end{aligned} $$

The standard deviation is \(\sqrt{17/9}=\sqrt{17}/3\approx 1.374\) points. Thus, the weighted distribution’s standard deviation is about 1.374 points. It summarizes spread around the weighted mean; it does not say that each score is within 1.374 points of the mean.

Worked Calculations From Survey Records

When survey weights are expansion weights, the records represent unequal amounts of the target population. For example, a weight of 3,000 indicates more represented population mass than a weight of 500. For a variance, the important operations are to calculate the weighted center and then average squared deviations using the total weight as the denominator.

Worked Example: Variance of a Discrete Survey Measure

In a hypothetical survey, six respondents report the number of clinic visits in the past year. Their values are 1, 2, 2, 4, 5, and 6 visits, and each record has weight 1. Calculate the weighted variance and standard deviation. Equal weights are nonnegative and have positive total weight, so the formula applies; in this example the weighted summaries equal the ordinary descriptive summaries of these six records.

The weighted total and weighted sum of squares are \(\sum_i w_i x_i=20\) visits and \(\sum_i w_i x_i^2=86\) visits\(^2\), with \(W=6\). The weighted mean is \(20/6=10/3\approx3.333\) visits. Applying the moment formula with exact fractions gives

$$ \begin{aligned} \widehat{\sigma}^{\,2}_w &= \frac{86}{6}-\left(\frac{20}{6}\right)^2\\ &= \frac{43}{3}-\frac{100}{9}\\ &= \frac{129}{9}-\frac{100}{9}\\ &= \frac{29}{9} \approx 3.222\text{ visits}^2. \end{aligned} $$

Therefore, \(\widehat{\sigma}_w=\sqrt{29}/3\approx1.795\) visits. The variance is in visits squared, while the standard deviation returns to visits. Rounding the mean before squaring can change the displayed arithmetic, so the exact fractions are retained through the calculation.

Worked Example: Expansion Weights and a Population-Style Summary

Consider hypothetical survey records for weekly travel time, measured in minutes. Three respondents report 10, 20, and 30 minutes, with expansion weights 2, 1, and 3. Assume the records are eligible for this summary, the weights are the intended nonnegative representation weights for the target distribution, and their total is positive. Find the weighted variance and standard deviation.

Here \(W=2+1+3=6\). The weighted mean is

$$ \bar{x}_w = \frac{2(10)+1(20)+3(30)}{6} = \frac{130}{6} = \frac{65}{3} \approx21.67\text{ minutes}. $$

The weighted second moment is \(\{2(10^2)+1(20^2)+3(30^2)\}/6=3300/6=550\) minutes\(^2\). Thus,

$$ \begin{aligned} \widehat{\sigma}^{\,2}_w &= 550-\left(\frac{65}{3}\right)^2\\ &= \frac{4950}{9}-\frac{4225}{9}\\ &= \frac{725}{9} \approx80.56\text{ minutes}^2, \end{aligned} $$

and the weighted standard deviation is \(\sqrt{725/9}\approx8.975\) minutes. The larger weight on the 30-minute record gives that value more influence on both the weighted mean and the distribution’s spread than the 20-minute record receives. The calculation describes the weighted distribution; it does not establish how uncertain the estimated mean is.

Descriptive Spread Is Not Sampling Uncertainty

A variance or standard deviation describes differences among the values in a distribution. A standard error describes the sampling variability of an estimator across repeated samples under a specified design. These answer different questions. In a survey, the standard deviation of an outcome can be large even when the mean is estimated precisely, or modest while the mean is estimated imprecisely because of the design or limited effective information.

The weighted variance formula above uses the values and their weights. It does not include the information needed to calculate design-based uncertainty, such as how units were selected, whether sampling was clustered or stratified, and how the weights were constructed. Consequently, taking \(\widehat{\sigma}_w/\sqrt{n}\) is not generally a valid standard error for a survey-weighted mean. Design-consistent standard errors require methods that account for the survey design.

QuantityWhat it describesUnits
Weighted varianceWeighted average squared distance of values from their weighted meanSquared outcome units
Weighted standard deviationSpread of values around the weighted mean, on the outcome scaleOutcome units
Standard error of a weighted meanSampling variability of the estimated mean under a specified survey designOutcome units

Denominator, Units, and Common Pitfalls

This is a population-style descriptive variance: divide the weighted sum of squared deviations by \(W\), the sum of the weights. Do not substitute \(W-1\) as a routine correction. The familiar sample-variance correction is intended for a different setting: estimating an unknown variance from a simple random sample under particular assumptions. It is not the defining denominator for the weighted distribution summary taught here, and it does not automatically correct complex-survey estimates.

Units provide a useful check. If \(x_i\) is measured in minutes, then \(x_i-\bar{x}_w\) is in minutes, its square is in minutes\(^2\), and the weighted variance is in minutes\(^2\). Taking the square root produces a standard deviation in minutes. Reporting a variance in the original units, or a standard deviation in squared units, signals a unit error.

Another important check is nonnegativity. Each \(w_i(x_i-\bar{x}_w)^2\) is nonnegative when \(w_i\geq0\), so their sum divided by \(W>0\) cannot be negative. A slightly negative result from the moment formula can arise from rounding or numerical precision; recalculate using unrounded values or the squared-deviation formula rather than interpreting it as a meaningful negative variance.

Common mistake: “The weighted standard deviation is 8.975 minutes, so the survey mean has a standard error of 8.975 minutes divided by the square root of the number of respondents.” This confuses outcome spread with estimator uncertainty. The weighted standard deviation summarizes spread in the weighted distribution; a survey mean’s standard error must account for the sampling design and cannot generally be obtained from that shortcut.
Key takeaway: Calculate weighted population variance by averaging squared deviations from the weighted mean with the survey weights and denominator \(W\). Take the square root for a spread measure in the original units. Neither quantity is automatically the standard error of a survey estimate.

Check Your Understanding

Answer each question using the definitions and distinctions in this tutorial.

  1. A weighted distribution has \(W=10\), weighted mean 4, and weighted sum of squared deviations 30. What are its weighted variance and standard deviation, including units if the values are in kilograms?
  2. Why does the weighted population-variance formula divide by \(W\) rather than routinely using \(W-1\)?
  3. A variable is measured in hours. What are the units of its weighted variance and its weighted standard deviation?
  4. Explain why a weighted standard deviation alone does not determine the design-based standard error of a weighted mean.
  5. Using the moment formula, what two weighted quantities are needed to calculate variance, in addition to the total weight?
Clinical Biostats