Using Excel 2010 : Adding Linear Regression Trendline to A Scatterplot

Introduction

We continue from the earlier article “Using Excel : 2010 Linear Regression Analysis”

Adding Linear Regression Trend Line

Suppose you have two columns of data in Excel and you want to insert a scatter plot to examine the relationship between the two variables.

Begin by selecting the data in the two columns.

scatterplot-trendline-1

Then, click on the Insert tab on the Ribbon and locate the Charts section.

scatterplot-trendline-2

Click on the button labeled Scatter and then select the button from the menu titled Scatter with Only Markers.

 scatterplot-trendline-3

You should now have a scatter plot with your data represented in the chart.

scatterplot-trendline-4

Now that you have a scatter plot in your Excel worksheet, you can now add your trend line. Begin by clicking once on any data point in your scatter plot. This can be tricky because there are many elements of the chart you can click on and edit. You will know that you have selected the data point when all of the data points are selected. Once you have selected the data points, right click on any one data point and choose Add a Trend line from the menu.

scatterplot-trendline-5

You should now be looking at the Format Trend line window. This window contains many options for adding a trend line into an Excel scatter plot. Notice that you can add
an ExponentialLinearLogarithmicPolynomialPower, or Moving Average trend/regression type of line. For now, leave the default Linear option selected.

scatterplot-trendline-6

Click the Close button and your chart should now be displaying a linear regression trendline.

scatterplot-trendline-7

As with all things Microsoft Office, you can format your trendline to look exactly as you want. In the next section, we will discuss some of the more popular changes you can make to your trendline to make it stand out.

Formatting an Excel Trend Line

To format your newly-created trend line, begin by right clicking on the line and selecting Format Trend line from the menu. Excel will once again open up the Format Trend line window.

scatterplot-trendline-8

One of the more popular options people use when adding a trendline to Excel is to display both the equation of the line and the R-squared value right on the chart. You can find and select these options at the bottom of the window. For now, select both of these options.

scatterplot-trendline-9

scatterplot-trendline-10

Let’s say that we want our trendline to be displayed more prominently on the chart. After all, the default trendline is only one pixel wide and can sometimes disappear among the colors and other elements on the chart. On the left hand side of the Format Trend line window, click on the Line Style option.

scatterplot-trendline-11

In this window, change the Width value from 0.75 pt to about 3 pt and change the Dash Type to the Square Dot option (third one down on the drop down menu).

scatterplot-trendline-12

Just to demonstrate that the option exists, change the End Type option to an arrow.

scatterplot-trendline-13

When you are done, click the Close button on the Format Trend line window and notice the changes to your scatter plot. Notice that the equation of the line and R-square values are now displayed on the chart and that the trend line is a more prominent element of the chart.

scatterplot-trendline-14

Like many functions in Excel, there are virtually limitless options you have available to you when displaying a trendline on a scatter plot. You can change the color and thickness of the line and you can even add 3D elements to it such as a shadowing effect.

What you choose depends on how prominently you want your trendline to stand out on your plot. Play around with the options and you can easily create a professional looking trendline in Excel.

Advertisements