Learning

open
close

Best-Fit Linear Model

June 23, 2025 | by Bloom Code Studio

Learning Outcomes

By the end of this section, you will be able to:

  • Calculate the slope and y-intercept for a linear regression model using technology.
  • Interpret and apply the slope and y-intercepts.

Calculate the Slope and y-Intercept for a Linear Regression Model Using Technology

Once a correlation has been deemed as significant, a best-fit linear regression model is developed. The goal in the regression analysis is to determine the coefficients a and b in the following regression equation:

yˆ=a+bxy^=a+bx

14.10

The slope (b) and y-intercept (a) can be calculated using the following formulas:

b a == n∑xy − (∑x)(∑y)n∑x2 − (∑x)2 ∑yn − b∑xnb = n∑xy – ∑x∑yn∑x2 – ∑x2a = ∑yn – b∑xn

14.11

These formulas can be quite cumbersome, especially for a significant number of data pairs, and thus technology is often used (such as Excel, a calculator, R statistical software, etc.).

Using Excel: To calculate the slope and y-intercept of the linear model, start by entering the (x, y) data in two columns in Excel. Then the Excel commands =SLOPE and =INTERCEPT can be used to calculate the slope and intercept, respectively.

The following data set will be used as an example: the monthly amount spent on advertising and the monthly revenue for a Fortune 500 company for 12 months (data is shown in Table 14.4).

MonthAdvertisingExpenditureRevenue
Jan4912,210
Feb14517,590
Mar5713,215
Apr15319,200
May9214,600
Jun8314,100
Jul11717,100
Aug14218,400
Sep6914,100
Oct10615,500
Nov10916,300
Dec12117,020

Table 14.4 Revenue versus Advertising for Fortune 500 Company ($000s)

To calculate the slope of the regression model, use the Excel command

=SLOPE(y-data range, x-data range)

It’s important to note that this Excel command expects that the y-data range is entered first and the x-data range is entered second. Since revenue depends on amount spent on advertising, revenue is considered the y-variable and amount spent on advertising is considered the x-variable. Notice the y-data is contained in cells C2 through C13 and the x-data is contained in cells B2 through B13. Thus the Excel command for slope would be entered as

=SLOPE(C2:C13, B2:B13)

In the same way, the Excel command to calculate the y-intercept of the regression model is

=INTERCEPT(y-data range, x-data range)

For the data set shown in the above table, the Excel command would be

=INTERCEPT(C2:C13, B2:B13)

The results are shown in Figure 14.6, where

slope b intercept a == 61.8 9,376.7slope b = 61.8intercept a = 9,376.7

14.12

A screenshot of a spreadsheet showing the Excel commands to calculate the slope and intercept of monthly values for advertising expenditure and revenue from January to December. The calculated slope is 61.8 and the calculated intercept is 9,376.7.

Figure 14.6 Revenue versus Advertising for Fortune 500 Company ($000s) Showing Slope and y-Intercept Calculation in Excel

Based on this, the regression equation can be written as

yˆyˆ = =a+bx9,376.7+61.8xy^ = a+bxy^=9,376.7+61.8x

14.13

where x represents the amount spent on advertising (in thousands of dollars) and y represents the amount of revenue (in thousands of dollars).

Using a Financial Calculator

The financial calculator provides the slope and y-intercept for the linear regression model once the (x, y) data is inputted into the calculator.

Follow the steps in Table 14.5 for calculating the slope and y-intercept for the data set of amounts spent on advertising and revenue shown previously.

StepDescriptionEnterDisplay
1Enter [DATA] entry mode2ND [DATA]X010.00
2Clear any previous data2ND [CLR WORK]X010.00
3Enter first x-value of 4949 ENTERX01 =49.00
4Move to next data entryY01 =1.00
5Enter first y-value of 1221012210 ENTERY01 =12,210.00
6Move to next data entryX020.00
7Enter second x-value of 145145 ENTERX02 =145.00
8Move to next data entryY02 =1.00
9Enter second y-value of 1759017590ENTERY02 =17,590.00
10Move to next data entryX030.00
11Continue to enter remaining data values
12Enter [STAT] mode2ND [STAT]
13Press [SET] until LIN appears2ND [SET]LIN
14Move to 1st statistical resultn=n=12.00
15Move to next statistical resultx¯=x¯=103.58
16Continue to scroll down until the value of a is displayeda=a=9,376.70
17Continue to scroll down until the value of b is displayedb=b=61.80

Table 14.5 Calculator Steps for the Slope and y-Intercept

From the statistical results shown on the calculator display, the slope b is 61.8 and the y-intercept a is 9,367.7.

Based on this, the regression equation can be written as

yˆyˆ =  = a+bx9,376.7+61.8xy^ = a+bxy^ = 9,376.7+61.8x

14.14

Interpret and Apply the Slope and y-Intercept

The slope of the line, b, describes how changes in the variables are related. It is important to interpret the slope of the line in the context of the situation represented by the data. You should be able to write a sentence interpreting the slope in plain English.

Interpretation of the Slope

The slope of the best-fit line tells us how the dependent variable (y) changes for every one unit increase in the independent (x) variable, on average.

In the previous example, the linear regression model for the monthly amount spent on advertising and the monthly revenue for a Fortune 500 company for 12 months was generated as follows:

yˆyˆ = =a+bx9,376.7+61.8xy^ = a+bxy^=9,376.7+61.8x

14.15

Since the slope was determined to be 61.8, the company can interpret this to mean that for every $1,000 dollars spent on advertising, on average, this will result in an increase in revenues of $61,800.

The intercept of the regression equation is the corresponding y-value when.

Interpretation of the Intercept

The intercept of the best-fit line tells us the expected mean value of y in the case where the x-variable is equal to zero.

However, in many scenarios it may not make sense to have the x-variable equal zero, and in these cases, the intercept does not have any meaning in the context of the problem. In other examples, the x-value of zero is outside the range of the x-data that was collected. In this case, we should not assign any interpretation to the y-intercept.

In the previous example, the range of data collected for the x-variable was from $49 to $153 spent per month on advertising. Since this interval does not include an x-value of zero, we would not provide any interpretation for the intercept.

RELATED POSTS

View all

view all