AI Glossary / Statistics and probability / Intermediate

MS within (MS error )

Definition

MS within, also called MS error or the within-groups mean square in a basic one-way ANOVA, is the within-groups sum of squared deviations divided by its residual degrees of freedom. Each observation is compared with its own group mean. With N observations across k groups, the denominator is N - k. Under the classical common-variance model, MS within estimates the shared residual variance. It provides the denominator of the ordinary one-way ANOVA F statistic and helps distinguish differences among group means from variation among observations within the same group.

What it means

Observations usually differ even when they belong to the same group. Some of that variation reflects unmeasured influences, natural variability or measurement noise. The within-group calculation summarizes what remains after each group receives its own fitted mean. The word error does not imply that every deviation is a mistake. It refers to residual variation under the specified model. In a more elaborate regression or ANOVA, the residual mean square and degrees of freedom depend on the fitted design rather than always following the simple one-way formula.

How it works

Calculate every group mean and subtract that mean from each observation in the group. Square the deviations and add them across groups to obtain SS within. Divide by N - k for the ordinary independent-groups one-way model. Equivalently, combine each group sample variance with weight ni - 1, then divide by the sum of those weights. Use the result as a pooled variance estimate only when that interpretation is appropriate. Inspect residual patterns and the study design, because unequal variances, dependent observations or omitted structure can make the usual pooled analysis misleading.

Three practical examples

  • Process analysis: summarize the remaining variability among measurements from the same operating condition.
  • Experimental comparison: provide the residual variability used in a one-way test of several group means.
  • Precision assessment: help calculate standard errors for group comparisons under the common-variance model. A lower MS within can indicate more precise measurements or a more homogeneous sample, but its meaning depends on how the data were obtained.

Think of it this way

Think of several teams aiming at their own targets. The within-group calculation measures how far each team's results scatter around its own center, without counting the distance between the centers. Moving every team's center together would not change that scatter. It is a measure of residual spread, not a judgment about which center is preferable.

Worked example

Consider two artificial groups: A contains 2 and 4, and B contains 5, 7 and 9. Their means are 3 and 7. Group A contributes (2 - 3)^2 + (4 - 3)^2 = 2 to SS within. Group B contributes (5 - 7)^2 + (7 - 7)^2 + (9 - 7)^2 = 8. Total SS within is 10. There are N = 5 observations and k = 2 groups, so MS within is 10/(5 - 2) = 10/3, approximately 3.3333. The individual sample variances are 2 and 4. Their unweighted average is 3, which is not the pooled result because the groups have different residual degrees of freedom. The correct weighting gives [1 times 2 + 2 times 4]/3 = 10/3. Adding 100 to every observation changes the means but leaves MS within unchanged.

Illustrative case study

In a fictional case, Hazel Testing compares measurements from several production settings. A manager assumes that a large MS error means technicians entered data incorrectly. The analyst explains that the value includes real item-to-item variation left unexplained by the group means. Residual inspection shows that one setting has much greater spread than the others. Rather than relying automatically on a common pooled variance, the team investigates the process and considers an analysis that accommodates differing variances.

Common misconceptions and mistakes

MS within is not the overall variance of all observations, because deviations are measured from group means rather than the grand mean. It is not usually the simple average of group variances when group sizes differ. Its units are squared outcome units, while its square root returns to the outcome scale. Error is not synonymous with measurement error alone. A small residual mean square does not guarantee a valid study or a useful effect. Repeated measurements from the same unit cannot automatically be treated as independent observations with the ordinary N - k denominator.

Business use

Businesses should interpret MS within alongside group summaries, residual diagnostics and the sampling structure. Record how independent units were defined and whether the pooling assumption is credible. Consider the impact of measurement precision, process heterogeneity and omitted variables before attributing residual variation to a single cause. When comparing analyses, account for changed units, populations and models. A reduced residual mean square can support more precise estimation, but it can also reflect an unrepresentative sample or an overfit model, so it should not be optimized without regard to the task.

People also ask

Why is the denominator N - k?

Estimating one mean for each of k groups uses k degrees of freedom in the basic one-way model.

What does the square root represent?

It is a residual standard-deviation estimate under the relevant model assumptions, expressed in the outcome's units.

Is MS error always computed from group means?

No. In other models, it is based on residuals from the fitted model and its corresponding residual degrees of freedom.

Check your understanding

Two unequal-sized groups have sample variances 2 and 4. Is their pooled MS within necessarily 3?

Answer: No. Weight each variance by its group degrees of freedom before dividing by the total residual degrees of freedom.

Related terms

  • Residual variance
  • Pooled variance
  • Degrees of freedom
  • error sum of squares
  • ANOVA
  • heteroscedasticity
  • F statistic
  • residual standard deviation

Learn next

Calculate within-group deviations for a small dataset and compare them with deviations from the grand mean. Then study residual plots and alternatives to equal-variance one-way ANOVA.

  • One-way ANOVA

More in Statistics and probability

  • Motion model - A motion model describes how the state of a moving object or robot changes over time, often in response to control inputs.
  • Moving average crossover - A moving average crossover occurs when one moving average moves from one side of another moving average to the other.
  • MS between groups (MS group ) - MS between groups, also written MS group or between-groups mean square, is the between-groups sum of squares divided by its degrees of freedom in an...
  • Multi-class logistic regression - Multi-class logistic regression is a classification method that estimates probabilities for more than two mutually exclusive outcome categories.
  • Multinomial distribution - The multinomial distribution describes the counts of outcomes in a fixed number of independent trials when each trial falls into exactly one of several...
  • Multinomial Naive Bayes - Multinomial Naive Bayes is a probabilistic classification method commonly used with nonnegative feature counts, especially word counts in text.

Sources

NIST/SEMATECH e-Handbook, One-Way ANOVA: https://itl.nist.gov/div898/handbook/ppc/section2/ppc231.htm NIST/SEMATECH e-Handbook, One-Factor ANOVA, residuals and mean squares: https://itl.nist.gov/div898/handbook/eda/section3/eda354.htm

Previous: MS-SSIM Next: MTD(f)

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer