ThisCalculator

Everyday

One Way ANOVA Formula & How to Use It

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

One Way ANOVA Formula & How to Use It

This calculator computes the F-ratio for a one-way ANOVA from the group means, sample sizes, and variances you enter, and it returns the F-statistic and its p-value. You provide summary data for each group (sample size, mean, standard deviation), and the calculator does the rest, showing the between-group and within-group sums of squares along the way.

Formula

The one-way ANOVA tests whether the means of three or more independent groups are equal. The test statistic is the ratio of between-group variability to within-group variability:

F = (SSB / (k − 1)) / (SSW / (N − k))

Where:

  • SSB = sum of squares between groups = Σ ni (xÌ„i − xÌ„grand)²
  • SSW = sum of squares within groups = Σ (ni − 1) si²
  • k = number of groups
  • N = total sample size (sum of all ni)
  • xÌ„i = mean of group i
  • si = standard deviation of group i (sample SD)
  • xÌ„grand = overall mean of all observations combined

In the calculator above, the first output is the F-statistic. The second is the p-value, computed from the F-distribution with degrees of freedom (k−1, N−k).

Worked Example

Using the default values: three groups, each with n = 5, means 10, 12, 14, and SDs 2, 2, 2.

  1. Grand mean = (5×10 + 5×12 + 5×14) / 15 = (50+60+70)/15 = 180/15 = 12.
  2. SSB = 5(10−12)² + 5(12−12)² + 5(14−12)² = 5(4) + 5(0) + 5(4) = 20+0+20 = 40.
  3. SSW = (5−1)(2²) + (5−1)(2²) + (5−1)(2²) = 4×4 + 4×4 + 4×4 = 16+16+16 = 48.
  4. df between = k−1 = 2; df within = N−k = 12.
  5. MSB = 40/2 = 20; MSW = 48/12 = 4.
  6. F = 20/4 = 5.00.

The p-value for F = 5.00 with df (2,12) is approximately 0.026. Since it’s below 0.05, you would reject the null hypothesis and conclude that not all group means are equal.

When to Use One-Way ANOVA

Use one-way ANOVA when you have one categorical independent variable with three or more levels and one continuous dependent variable. For example, comparing test scores of students taught with three different methods. If you have only two groups, a two-sample t-test is equivalent and simpler. If you have two independent variables, use a two-way ANOVA instead.

Key assumptions:

  • Independence: observations are randomly sampled and independent.
  • Normality: the dependent variable is approximately normally distributed within each group.
  • Homogeneity of variance: the population variances are roughly equal across groups.

If these are violated, the F-test may be inaccurate. Welch’s ANOVA is a good alternative when variances are unequal, and the Kruskal-Wallis test is a nonparametric alternative.

How to Read the Result

The F-statistic measures how much the group means differ relative to the variability within groups. A large F (and a small p-value) indicates that the between-group variation is unlikely to be due to chance alone. The p-value tells you the probability of observing an F this large if all group means were truly equal.

If p < 0.05 (or your chosen alpha), you reject the null hypothesis and conclude that at least one group mean differs. But ANOVA does not tell you which groups differ. To find that, you need post-hoc tests like Tukey’s HSD, Bonferroni, or Scheffé. These adjust for multiple comparisons to control the overall error rate.

Common Mistakes

  • Using the wrong degrees of freedom. df between = k−1, df within = N−k. Confusing them changes the p-value.
  • Mixing up sample SD and population SD. The formula uses the sample SD (with n−1 in the denominator). If you enter the population SD, SSW will be too small.
  • Ignoring the assumptions. ANOVA is robust to moderate violations of normality, but serious violations can lead to wrong conclusions.
  • Running many t-tests instead of ANOVA. That inflates the Type I error rate. ANOVA is designed to compare all groups simultaneously.
  • Misinterpreting a non-significant result. Failing to reject H0 does not prove all means are equal; it just means the data are consistent with equality.

Limitations and Alternatives

ANOVA is a parametric test, so it relies on the assumptions above. When the data are severely non-normal or variances are very different, consider:

  • Welch’s ANOVA – does not assume equal variances.
  • Kruskal-Wallis test – nonparametric, based on ranks.
  • Permutation test – distribution-free, uses resampling.

Also, ANOVA only tells you that a difference exists. It does not measure the size of the effect. For that, compute eta-squared (η²) as SSB/SST, where SST = SSB + SSW. In the example, η² = 40/88 ≈ 0.455, meaning about 45% of the total variance is explained by group membership.

Frequently Asked Questions

What is the difference between one-way and two-way ANOVA?

One-way ANOVA has one independent variable (factor) with three or more levels. Two-way ANOVA has two factors and can test for interaction between them. For example, one-way could compare three diets; two-way could compare diets and exercise levels together.

Can I use ANOVA with unequal sample sizes?

Yes, one-way ANOVA works with unequal group sizes, but the test becomes less robust if the variances are also unequal. The sums of squares are weighted by sample size, so larger groups have more influence. If sample sizes are very different and variances are unequal, use Welch’s ANOVA.

What does a p-value of 0.05 mean in ANOVA?

It means that if the null hypothesis (all group means equal) were true, the probability of observing an F-statistic as large as yours would be 5%. It is a common threshold for rejecting the null, but you can choose a different alpha (e.g., 0.01 for stricter evidence).

How do I find which groups are different after ANOVA?

Use a post-hoc test such as Tukey’s HSD, which compares all pairs of groups while controlling the family-wise error rate. The calculator above does not perform post-hoc tests; you would need to run those separately.

What if my data are not normally distributed?

If the sample sizes are large (e.g., >30 per group), ANOVA is fairly robust to normality violations. For small samples or severe skewness, use the Kruskal-Wallis test, which does not require normality.

Can ANOVA be used for two groups only?

Yes, but the F-test with two groups is equivalent to a two-sample t-test. The F-statistic equals the square of the t-statistic, and the p-values are identical. Most software simply runs a t-test for two groups because it is more direct.

Related

Formula used
in n1 | Group 1 size | - | 5 | 2
in m1 | Group 1 mean | - | 10 | 0
in s1 | Group 1 SD | - | 2 | 0
in n2 | Group 2 size | - | 5 | 2
in m2 | Group 2 mean | - | 12 | 0
in s2 | Group 2 SD | - | 2 | 0
in n3 | Group 3 size | - | 5 | 2
in m3 | Group 3 mean | - | 14 | 0
in s3 | Group 3 SD | - | 2 | 0
out f | F-statistic | - | ((sum(n_i*(m_i-grand)^2)/(k-1)) / (sum((n_i-1)*s_i^2)/(N-k))) | 3
out p | p-value | - | 1 - f_cdf(f, k-1, N-k) | 4

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.