7.2.2 Worked Examples


Example 7.5. Estimating slope and y-intercept from a scatterplot
In the graph above (figure 7.13) we can easily make estimates of the slope and y-intercept of the trendline and use these to write down its equation. This equation could then be used to make predictions of other values.

The y-intercept appears to be about 21. It might be a little smaller, but clearly the trendline hits the y-axis above the tick mark for 20.

The slope is a little harder. We need two points on the line. Fortunately, this trendline seems to pass through several of the points on the scatterplot. (This is not always the case. The procedure for finding trendlines does not guarantee that the trendline will pass through any of the data points.) This line seems to pass through the points (3, 17) and (14, 5). Thus, when the run is (14 - 3) = 11 the line has a rise of (5 - 17) = -12 (notice the negative sign; it means that the relationship is indirect or decreasing). Thus, the slope of the line is approximately rise over run = -1211 which is about -1.091.

Putting this together, we get the equation of the line to be y = 21 - 1.091x.


Example 7.6. Using data to find the equation of a line
Suppose we have data that consists of only two points. This means that we have two ordered pairs: one for each point. The ordered pair is another way to give data. Rather than listing the variables in columns, we list the data like this: (1, 2) and (3, 6). These ordered pairs are given so that the first number is the value of the independent variable that is associated with the number after the comma, the dependent variable. For example, in the ordered pair (1, 2), the 1 is the independent variable that gives 2 for the dependent variable. The ordered pairs listed above would be identical to the table below:



X Y


1 2


3 6


How many straight lines are there that are a ”best fit” to the data above? Do you think this will be true for any two data points? If you play around with this for a little while, you’ll discover that only one line can be drawn that passes through both points. What would the slope of this ”best fit” be for the two point data set listed above? What about the y-intercept?

If we use the formulas above, the slope should be (6-2)/(3-1) = 4/2 = 2. This means that for every one unit we move to the right along this line, we also move two units up. Finding the y-intercept is a little trickier. Let’s use the slope-intercept form of the equation of a line. We already know the slope, so the equation must be y = A + 2x. To find A, just remember that we also know the point (1,2) is on the line, so 2 = A + 2(1). If we work with this expression, we find that 2 = A + 2, and the only number A which works in this equation is 0, so the y-intercept must be 0. This means that the equation of the line is y = 2x.

Note that we could also use the point (3, 6) to find the y-intercept, A. We should get the same equation for the line using either of the two points.


Example 7.7. Calculating Values from Trendlines (Making Predictions)
In August 1997 Consumer Reports printed an article on different makes of backpacks. They measured three variables for each backpack: average price, total volume (in cubic inches), and the number of standard 5” by 7” books it could hold. A sample of the data is shown in table 7.2. (The full data set C07 Backpacks.xls [.rda] includes 30 different backpacks.)





Price Volume

Number of Books




48 2200

59

45 1670

49

50 2200

48

42 1700

52

29 1875

52

50 1500

49

35 1950

49





Table 7.2: Data on backpacks from Consumer Reports.

After plotting the price of the data versus the number of books the bags hold, we get the following trendline equation (constants have been rounded to two decimal places):

Price = -30.68 + 1.46*Number of Books

The equation tells us that we can expect the price of a backpack to increase about $1.46 for each additional 5” x 7” book it holds. Thus, if a backpack were designed to hold 60 books, we could expect the price to be about

Price = -30.68 + 1.46*(60) = $56.92.

We can also ask the question another way: How many 5” x 7” books would you expect to fit into a backpack that you paid $45 for? To deal with this question, we can either set it up in a spreadsheet and try using GOAL SEEK to find the answer (see the how to guide for this section), or we can solve it with a little algebra:

$45 = -30.68 + 1.46*Number of Books

$45 + $30.68 = 1.46*Number of Books

$75.68 = 1.46*Number of Books

Number of Books = 75.68/1.46 = 51.84 which is about 52 books.