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

How to Calculate Sxy in Statistics (With Example)

by Erma Khan

In statistics, Sxy represents the sum of the product of the differences between x values and the mean of x and the differences between y values and the mean of y.

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

We use the following formula to calculate Sxy:

Sxy = Σ(xix)(yiy)

where:

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

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

Example: Calculating Sxy by Hand

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

Suppose we would like to calculate Sxy for this dataset.

First, we must calculate the mean value of x:

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

Then, we must calculate the mean value of y:

  • y = (8 + 12 + 14 + 19 + 22 + 21) / 6 = 16

Using these values, the following screenshot shows how to calculate the value for Sxy:

Sxy calculation in linear regression

The value for Sxy turns out to be 59.

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

The calculator returns a value of 59, 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 Sxy is just one calculation that we must perform in order to fit a simple linear regression model.

Related: How to Calculate Sxx 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