Being able to calculate linearity (or correlation, as it's often referred to) is a very valuable skill. Linearity is a quantitative assessment of how strongly related a set of data is. Linearity ranges from 0 (not related at all) to 1 (completely related) and gives a useful numerical gauge to be used alongside a numerical plot. For our calculations, the following sample (x, y) pairs will be used: x: 2.4, 3.4, 4.6, 3.7, 2.2, 3.3, 4.0, 2.1

y: 1.33, 2.12, 1.80, 1.65, 2.00, 1.76, 2.11, 1.63

## Calculating Sx

Add together all of your x-values and you get sum(x) = 25.7.

Calculate x^2 by squaring all of your individual x-values. This is done by multiplying each x-value by itself. Your x^2 values will be 5.76, 11.56, 21.16, 13.69, 4.84, 10.89, 16.00, 4.41.

Add together all of your x^2 values and you get sum(x^2) = 88.31.

Multiply sum(x) by itself to obtain sum(x)^2, which is equal to 660.49.

Divide sum(x)^2 by 8 (the total number of data pairs in our sample data). You will get an answer of 82.56.

Subtract 82.56 (answer from step 5) from sum(x^2) (answer from step 4). You will get an answer of 5.75, which we refer to as Sx.

## Calculating Sy

Add together all of your y-values and you get sum(y) = 14.40.

Calculate y^2 by squaring all of your individual y-values. This is done by multiplying each y-value by itself. Your y^2 values will be 1.7689, 4.4944, 3.2400, 2.7225, 4.0000, 3.0976, 4.4521, 2.6569.

Add together all of your y^2 values and you get sum(y^2) = 26.4324.

Multiply sum(y) by itself to obtain sum(y)^2, which is equal to 207.36.

Divide sum(y)^2 by 8 (the total number of data pairs in our sample data) and subtract that answer from sum(y^2). You will get an answer of 0.5124, which we refer to as Sy.

## Calculating Sxy

Calculate x_y by multiplying each x-value with its corresponding y-value. Your x_y values will be 3.192, 7.208, 8.280, 6.105, 4.400, 5.808, 8.440, 3.423.

Add together all of your x_y values and you get sum(x_y) = 46.856.

Multiply sum(x) by sum(y) and you will get an answer of 370.08.

Divide 370.08 by 8 (the total number of data pairs in our sample data). You will get an answer of 46.26.

Subtract 46.26 from sum(x*y) (from step 2) and you will get an answer of 0.5960, which we refer to as Sxy.

## Putting It Together

Take the square root of Sx and the answer will be 2.398.

Take the square root of Sy and the answer will be 0.716.

Multiply your answers from steps 1 and 2 and you will get an answer of 1.717.

Divide Sxy by 1.717 (from step 3) to calculate your final linearity of 0.347. A linearity this low suggests the data is loosely related and only slightly linear.

#### Tip

Write down your answers as you find them for easy access later.