INTERCEPT and SLOPE

For a given series we can add a trend line which, by applying the selected mathematical function, approximates and shows the trend of data, which was discussed in one of the earlier posts. By displaying the value of R2 we can see how well we chose the function that approximates the data. How else can you improve the trend line appearance?

Even if we chose a good function and R2 has a value very close to number 1, in some cases it would seem illogical. This is especially pronounced if we created a Scatter chart, and we know that for events X and Y, the trend line must go through the coordinate start. Next one should correct the trend line, and this is done by launching the Format Trendline option and further selecting Set Intercept option in the menu on the right, then specifying a numeric value. This is the value on the Y axis that the trend line should go through. If we choose a value of 0, it means that it goes through a coordinate start. Choosing this option will in most cases reduce the value of R2, but the appearance of the trend line will more closely match the actual state.

Excel also has an INTERCEPT function that, for given data, calculates a value on the Y axis where the trend line should pass. Its syntax is:

INTERCEPT (<X value range>,<Y value range>)

For the given data in the example it is necessary to write the formula:

=INTERCEPT (A2: A6, B2: B6)

The result is a value that should be entered as Set Intercept value in the Trendline Format menu in order to get the proper appearance of the trend line.

There is another function that we can use to calculate the slope. Its syntax:

SLOPE (<X value range>,<Y value range>)

So if we enter the formula:

=SLOPE(A1:A5,B1:B5)

the result is 0.9905.

If you look at the formula used to calculate the trend line, you will see within it the slope and the intercept.

y = 0.9095x + 3.318