Excel supports several functions related to linear regression. To use these, first enter the paired
data values in two columns. Put the explanatory variable in a column labeled with x, or an
appropriate descriptive name, and put the response variable in a column labeled with y, or an
appropriate descriptive name.
Excel functions and corresponding syntax are:
LINEST(y range, x range) which returns the slope b and y-intercept a of the least-squares line,
in that order.
SLOPE(y range, x range) returns the slope b of the least-squares line.
INTERCEPT(y range, x range) returns the intercept a of the least-squares line.
CORREL(y range, x range) returns the correlation coefficient r.
FORECAST(x value, y range, x range) returns the predicted y value for the specified x value, using extrapolation
from the given pairs of x and y values. Note that you need to use a new FORECAST command for each different x
Statistics Activity:
In retailing, merchandise loss due to shoplifting, damage, and other causes is called shrinkage. The
managers at H.R. Merchandise think that there is a relationship between shrinkage and the
number of clerks on duty. To explore this relationship, a random sample of seven weeks was
selected. During each week, the staffing level of sales clerks was held constant and the dollar
value (in hundreds of dollars) of the shrinkage was recorded. Use the data below to complete
statistics activity using Excel.
x, Clerks
y, Shrinkage (in
hundreds of dollars)
Enter Data
Open a new worksheet in Excel. Place the x values in Column A with a corresponding label and the
y values in Column B.
Create a Scatter Diagram
Select the data. Click on the Insert Ribbon and select Scatter (Excel 2010 visual next to pie chart).
Choose the first subtype, which shows only points.
Change Title and Add Axis Titles to Scatterplot
Change the title (Scatterplot) and add axis labels (x, clerks; y, shrinkage) by changing the Layout
(Excel 2010 Design – Add Chart Element).
Add regression line results to the plot
The regression line (or line of best fit, or least-squares line) can be added to the plot, along with its
equation and the value of R2. Right-click on one of the data points shown in the scatter diagram.
A drop-down menu will appear. Select Add Trendline to call up a dialog box. Be sure Linear is
selected as the Type. Check Display equation on chart and Display R-squared on chart,
and then click Close. Now our scatter diagram shows the graph of the least squares-line and the
equation. You can move the equation out of the way of the graph by clicking on it and dragging
the resulting box to a convenient location like in the image on the next page. The regression
equation is:
and R2 = 0.9281. Note: Excel does not put a hat on the y.
Scale the Axes
Sometimes all the points of a scatter diagram are in a corner, and we want to rescale the axes to
reflect the data range. To do so,
Right-click on the x-axis, select Format Axes.
2. Change the minimum and maximum values for x. You may retain 0 as the value for
Value (y) axis crosses at.
Go through a similar procedure to rescale the y-axis. The result of our changes appears as shown
at the top of the next page.
Calculating Correlation
Use CORREL(y range, x range) to find the correlation coefficient r. Type this command in cell
Press enter to get the correlation value of - 0.9634.
Forecast a Value
Let’s predict the shrinkage when fourteen clerks are available, using FORECAST. Click Insert
Function on the tool bar, then select Statistical in the drop down box and then Forecast (Excel
2010 Click Formulas – Insert Function – Statistical in the drop down box and then Forecast).
Fill in the dialog box as shown and click OK.
The predicted y value is about 10.05. Since the unit for y is hundreds of dollars, this represents
a predicted shrinkage of $1005 when fourteen clerks are on duty.
Save and label your completed Excel document using your initials (Ex. MR.xls). Upload
the Excel document using the link provided in Blackboard.