# Sum comparison test

The sum comparison test is a chi-square test that tests whether the sum of a specified measure is equal across all categories of the explanatory field.

Note: This statistical test is a fixed system operation and cannot be modified.

If the chi-square test value is significant, the sums are not all equal.

The test is constructed under the assumption that both means and counts of the measure are equal across different categories. The test uses a chi-square value. The following procedure describes how the chi-square value is calculated:

- Calculate the overall mean for the measure.
- Calculate the mean square for the measure error.
- Calculate the sum of squares for the measure error.
- Within each category, subtract the category’s mean from each record value.
- Take the square of each difference and add them together.

- Divide the sum of squares for the error source by the appropriate degrees of freedom.

- Calculate the sum of squares for the measure error.
- Calculate the squared error for the sum per category.
- Multiply mean square for the measure error by the expected category count.
- Use the total count divided by the number of categories as expected count.

- Multiply the squared count error by the square of the overall mean.
- Subtract the expected count from the total count.
- Multiply this result by the expected count.
- Divide this result by the total count.
- Multiply this result by the square of the overall mean.

- Add these two calculated terms to obtain the squared error for the sum.

- Multiply mean square for the measure error by the expected category count.
- Compute the chi-square term for each category.
- Compute the square of the difference of the average sum and the category sum.
- Divide the result by the squared error for the sum per category.

- Sum the chi-square terms from all categories. This sum is the chi-square value.

The chi-square value is compared to a theoretical chi-square distribution with appropriate degrees of freedom to determine the probability of obtaining the chi-square value by chance.

- This probability is the significance value.
- If the significance value is less than the significance level, the means are significantly different.