Two groups of students have their average scores in front of us: Group A has 100 students and averages 70 points; Group B has 25 students and averages 80 points. If we want to combine the two averages, and Group A is four times the size of Group B, should it get four times the weight? The answer depends on what we want to compute. If the goal is the average score of these 125 people, group size is the correct weight for combining; if the goal is to use the two group means to estimate a common population average, the weights also depend on how precise each mean is. The illustrative numbers below are used to separate the two questions.
Combining existing scores: recovering the total by group size
Start with a clear question: what is the average score of these 125 students? Group A's total is 100 × 70 = 7000 points, and Group B's total is 25 × 80 = 2000 points. The overall average is therefore (7000 + 2000) ÷ 125 = 72 points. Multiplying each group mean by its share of the students gives the same result: 70 × 80% + 80 × 20% = 72 points. Here group size serves to recover the share each group holds among all the students.
If the question changes to "what is the average of the two group averages, each counting for half," the result is (70 + 80) ÷ 2 = 75 points. The 72 gives every student the same share; the 75 gives every group the same share. Both numbers can be computed from the same table, yet they answer different questions. Before choosing weights, first decide whether what is being described is people or groups.
Estimating a common level: when group size stands for precision
Now take a different task: treat Groups A and B as two independent estimates of the same population average. Both 70 and 80 carry sampling error, and we want to combine them into a single estimate that is as precise as possible. What needs to be compared now is the error variance of the two group means: the smaller the variance, the more stable the mean is across repeated samples, and the larger the precision weight it receives. Stata calls weights that are inversely proportional to the variance of an observation analytic weights; group means are a typical application.[1][2]
Suppose every student's score error is independent of the others and has an error variance of 100 squared points. For a group of n people, the error variance of the average score is then 100 ÷ n: 1 squared point for Group A and 4 squared points for Group B. Assigning weights by the inverse of the variance, A and B receive 1 and 1/4, which as shares are 80% and 20%. The precision-weighted estimate is therefore also 72 points. This result happens to equal the one from combining by group size, but the judgment it rests on is that the mean of the larger group is more precise in exactly this proportion.[1]
If students in the same group are affected by common factors, their errors may run high or low together, and adding more people cannot remove error as quickly as independent sampling would. Keep the same two groups as an illustration: suppose the individual error variance is 100 squared points in both groups, the error correlation between any two people in Group A is 0.20, errors within Group B are mutually independent, and the two groups are independent of each other. The error variance of Group A's mean becomes 100 × (0.20 + 0.80 ÷ 100) = 20.8 squared points; Group B's is still 100 ÷ 25 = 4 squared points.
Group A now has more people, yet the error variance of its mean is larger. Taking the reciprocals of the two variances and rescaling them into weights that sum to 1, Group A receives 5/31 and Group B receives 26/31. The precision-weighted estimate of the common level is then (5 × 70 + 26 × 80) ÷ 31, about 78.39 points. Group B gets the larger weight because, under these assumptions, its mean is more precise.
The 78.39 does not replace the earlier 72. The 72 is a calculation of the actual average score of these 125 students; the 78.39 is an estimate of the common level, given that both group means are unbiased estimates of the same population level and that the error structure is as specified above. One result summarizes people who have already been observed; the other uses uncertain sample means to estimate an unknown quantity. They use the same means and group sizes, but the targets of the calculation differ.
From combining averages to regression
The same reasoning appears in regressions on group means. Suppose each row is a school district, recording the district's average score, average class size, and number of sampled students, and the researcher wants to estimate the linear relationship between average class size and average score. Weighted regression lets rows with larger weights have more influence on how the fitting error is computed. If individual errors are independent with equal variance, the variance of a district's average error is inversely proportional to its number of students, and that number can serve as a precision weight.[1]
Specifically, weighted least squares chooses a line so that the squared "average score minus predicted value" for each district, multiplied by that district's weight and then summed, gives a total that is as small as possible. Group size affects the weight of each row's error in this fitting problem; it does not mean that a district's contribution to the final slope exactly equals its share of the students. Its class-size value, and where it sits relative to the other districts, affect the slope as well.
The Stata authors used simulated data to compare weighted and unweighted regressions. In the scenario they set up with independent, homoskedastic individual errors, the estimates weighted by group size were more precise than the unweighted ones; in another set of ordinary least squares simulations with a common cluster error, weighting by group size instead produced a larger root mean squared error. The results show that whether group size is a suitable proxy for precision depends on the error structure, and cannot be decided merely by whether the data table has a column for the number of people.[1]
First identify what problem the weight is solving
Analytic weights also differ from sampling weights. The former describe the relative precision of observations; the latter, in Stata's definition, relate to the probability that a sample unit was selected and are used to reflect the sampling design. Frequency weights, in turn, indicate how many times a row of identical observations occurred.[2] Even if a column of numbers is labeled "number of people," we first need to work out whether it records the number of people making up a mean, the number of people represented, or the number of repeated observations before deciding how it should enter the analysis.
Return to the two groups of scores at the start: to find the average score of these 125 people, use group size to recover the total; to compare the average levels of the two groups, each group can count for half; to estimate a common level from group means, examine the error variance of each mean. Sometimes group size happens to reflect precision, and sometimes shared fluctuation within a group changes that relationship. Only by first writing down the goal, and then stating what quantity the weight corresponds to, can the weighted number be read correctly.
References
-
Eduardo Garcia Echeverri, Tom Stringham. Analytic weights: When, how, and why. 2026-08-18.
-
StataCorp. Stata User’s Guide: 11 Language syntax, 11.1.6 weight. n.d.
-
Research Methods · Rituals can be imitated; understanding cannot be faked.
-
Compiled and published by the Scholay one-stop academic platform. If anything here infringes your rights, please report it and it will be taken down.
-
Also published on Enter Scholar, a community for scholars in the age of AI.