Home » How to Calculate Sxx in Statistics (With Example)

How to Calculate Sxx in Statistics (With Example)

by Erma Khan

In statistics, Sxx represents the sum of squared deviations from the mean value of x.

This value is often calculated when fitting a simple linear regression model by hand.

We use the following formula to calculate Sxx:

Sxx = Σ(xix)2

where:

  • Σ: A symbol that means “sum”
  • xi: The ith value of x
  • x: The mean value of x

The following example shows how to use this formula in practice.

Example: Calculating Sxx by Hand

Suppose we would like to fit a simple linear regression model to the following dataset:

Suppose we would like to calculate Sxx, which represents the sum of squared deviations from the mean value of x.

First, we must calculate the mean value of x:

  • x = (1 + 2 + 2 + 3 + 5 + 8) / 6 = 3.5

Next, we can use the following formula to calculate the value for Sxx:

  • Sxx = Σ(xix)2
  • Sxx = (1-3.5)2+(2-3.5)2+(2-3.5)2+(3-3.5)2+(5-3.5)2+(8-3.5)2
  • Sxx = 6.25 + 2.25 + 2.25 + .25 + 2.25 + 20.25
  • Sxx = 33.5

The value for Sxx turns out to be 33.5.

This tells us that the sum of squared deviations between the individual x values and the mean x value is 33.5.

Note that we could also use the Sxx Calculator to automatically calculate the value of Sxx for this model as well:

ssx calculator for linear regression

The calculator returns a value of 33.5, which matches the value that we calculated by hand.

Note that we use the following formulas to perform simple linear regression by hand:

y = a + bx

where:

  • a = y – bx
  • b = Sxy / Sxx

The calculation for Sxx is just one calculation that we must perform in order to fit a simple linear regression model.

Related: How to Calculate Sxy in Statistics

Additional Resources

The following tutorials explain how to perform other common tasks in statistics:

How to Perform Simple Linear Regression by Hand
How to Perform Multiple Linear Regression by Hand

Related Posts