The Sxx refers to the sum of squares due to the variable x in both linear regression and ANOVA. It basically measures the amount of variation introduced in the data because of the x variable.

**Formula for Sxx Variance:**

The sum of squares due to x, that is the Sxx variance can be calculated using the formula, S_{xx}= \frac{\sum (x_i - \bar{x})^2}{n}

- Here x_i denotes the given data values of the variable x.
- \bar{x} denotes the mean/average of the x data values.
- n denotes the number of given data values of the variable x.

Alternatively, the sum of squares Sxx can also be calculated using the formula, S_{xx}= \frac{\sum (x_i )^2}{n} - (\bar{x})^2

The alternative formula is obtained from the original formula by simply expanding the square and carrying out the algebraic simplifications. The original formula and the alternative formula both give the same answer. The advantage of the alternative formula is that the calculations are much easier to carry out by hand.

**Example 1:**

We now illustrate how to calculate Sxx for given data values using the original formula. Consider the following 5 data values: 3, 7, 12, 8, 5

We first calculate the mean of the given values, \bar{x} = \frac{\sum{x_i}}{n} = \frac{3+7+12+8+5}{5} = \frac{25}{5} =5

We then obtain the square of the differences as follows,

x_i | (x_i - \bar{x})^2 |

3 | (3-5)^{2} = (-2)^{2} = 4 |

7 | (2)^{2} = 4 |

12 | (7)^{2} = 49 |

8 | (3)^{2} = 9 |

5 | (0)^{2} = 0 |

\sum (x_i - \bar{x})^2 = 66 |

We now compute the Sxx value as follows, S_{xx}= \frac{\sum (x_i - \bar{x})^2}{n} = \frac{66}{5} = 13.2

**Example 2:**

Next, we will see an example of how to calculate Sxx for given data values using the alternative formula. Consider the following 8 data values: 4, 6, 2, 7, 1, 10, 3, 7

We first calculate the mean of the given values, \bar{x} = \frac{\sum{x_i}}{n} = \frac{4+6+2+7+1+10+3+7}{8} = \frac{40}{8} =5

We then obtain the squares of the data values as follows,

x_i | x_i^2 |

4 | (4)^{2} = 16 |

6 | 36 |

2 | 4 |

7 | 49 |

1 | 1 |

10 | 100 |

3 | 9 |

7 | 49 |

\sum x_i^2 = 264 |

Using the alternative formula we obtain that, S_{xx}= \frac{\sum (x_i )^2}{n} - (\bar{x})^2 = \frac{264}{5} - 5^2 = 52.8 - 25 = 27.8