How to Calculate Sxy in Statistics (With Example)

Sxy is a statistic used to measure the strength of the linear relationship between two variables x and y. It is calculated by taking the covariance of x and y, and then dividing it by the standard deviation of x multiplied by the standard deviation of y. An example of calculating Sxy is to take the covariance of two sets of data and divide it by the product of the standard deviations of each set of data. For example, if the covariance of x and y is -2 and the standard deviation of x is 4 and the standard deviation of y is 3, then Sxy would be -2/(4*3) which equals -0.167.


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 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

Note that we could also use the 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:

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

x