11.7 Regression (Distance from School)

Aligned outcomes:

SLO 2

Identify appropriate graphs and summary statistics for variables and relationships between them and correctly interpret information from graphs and summary statistics.

SLO 4

Demonstrate an understanding of, and ability to use, basic ideas of statistical processes, including hypothesis tests and confidence interval estimation.

Learning Objectives

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

In this section, you will learn to:
  • collect real bivariate data from your classmates and decide which variable is independent and which is dependent;
  • calculate and construct the line of best fit between two variables, including its slope, intercept, and equation;
  • evaluate the relationship between two variables to determine whether that relationship is statistically significant;
  • use your fitted line to make predictions and judge whether those predictions are reasonable.

11.7.1 Stats Lab: Regression (Distance from School)

Class Time:

Names:

This section is a hands-on lab rather than a reading exercise. You will gather real numbers from people sitting near you, run a regression analysis on them, and then defend your conclusions in writing. Everything you compute here uses the same tools you will use on any two-variable dataset later in the course — the variables just happen to be ones you can ask about across a desk.

Try It Now 11.7.1

Before touching any data, write down — in your own words — what a "line of best fit" is supposed to accomplish when the points on a scatter plot do not all sit exactly on one straight line.

Solution

A line of best fit is the single straight line that comes closest, overall, to all the data points at once. Almost no real dataset lands perfectly on a line, so instead of demanding a perfect fit we choose the line that minimizes the total of the squared vertical distances between each point and the line. That line gives us two useful things: a compact summary of the trend (its slope and intercept) and a tool for predicting the \(y\)-value at any \(x\)-value we care about. The individual points will still miss the line by small amounts — those misses are called residuals — but the line captures the overall pattern.

Student Learning Outcomes

In this section, you will learn to:
  • The student will calculate and construct the line of best fit between two variables.

These two outcomes build on each other. First you build the line — that is the mechanical part your calculator does most of. Then you judge it: does the correlation you found reflect a real relationship, or could eight random pairs of numbers have produced something similar by luck? A regression line without a significance check is like a weather forecast with no confidence level attached — it looks authoritative whether or not it deserves to.

Try It Now 11.7.2

Explain the difference between "finding a correlation" and "finding a significant correlation." Why does the second phrase require knowing how large your sample is?

Solution

Finding a correlation means computing \(r\), a number between \(-1\) and \(+1\) that measures how tightly your points hug a straight line. Finding a significant correlation means deciding whether that value of \(r\) is too large to be explained by chance alone in a sample of your size. Sample size matters because small samples produce big correlations by accident surprisingly often: with only \(n = 8\) pairs, even coin-flip noise can yield an \(|r|\) around 0.5 or more. The critical value from the correlation table accounts for this — it gets closer to 0 as \(n\) grows, because larger samples make chance correlations less likely. So the same numeric \(r = 0.60\) might be significant with \(n = 30\) but not significant with \(n = 8\).

11.7.2 Collect the Data

Use eight members of your class for the sample. Collect bivariate data (distance an individual lives from school, the cost of supplies for the current term).

Why these two variables?

Distance from school and supply cost might seem unrelated, but both could rise together — students who live far away may buy more gas, more meals on campus, or supplies they forgot at home. A regression line lets you test whether that pattern is real or just noise in eight data points.

Bivariate data means each person gives you two numbers: how far they live from school, and how much they spent on supplies this term. You will record both values for each of the eight people, so every row of your table holds a matched pair. Ask each person both questions at the same time so the two answers stay attached to the right person — if you collect distances from one group and costs from another, the pairing is destroyed and the regression is meaningless.

  1. Complete the table.
Table 11.7.1 — Distance from school and cost of supplies for eight classmates.
Distance from school (miles)Cost of supplies this term (dollars)
  1. Which variable should be the dependent variable and which should be the independent variable? Why?

Think about cause and effect here. The question you would naturally ask is "does living farther away change what a student spends?" — not "does spending money change where a student lives?" The variable you suspect does the influencing goes on the horizontal axis as the independent variable (\(x\)); the variable you suspect gets influenced goes on the vertical axis as the dependent variable (\(y\)). Here, distance is the natural independent variable and cost of supplies is the natural dependent variable, because we want to predict cost from distance.

  1. Graph "distance" vs. "cost." Plot the points on the graph. Label both axes with words. Scale both axes.

Put distance on the horizontal axis and cost on the vertical axis. Choose a scale that spreads your points across most of the grid — if distances run from 2 to 30 miles, don't label your axis out to 100. Each classmate becomes one dot on the scatter plot.

Figure 11.7.1 — Scatter plot grid for distance versus cost of supplies.

Try It Now 11.7.3

Before collecting any numbers, suppose a classmate suggests making cost the independent variable and distance the dependent variable. Explain why that choice would make the prediction backwards, and state which assignment you will use instead.

Solution

If cost were the independent variable, the fitted line would answer the question "given how much a student spent, how far do they live?" — but nobody picks a home based on last term's supply bill. The useful direction of prediction runs the other way: we know (or can ask) where someone lives, and we want to estimate their spending. So distance belongs on the \(x\)-axis as the independent variable and cost of supplies belongs on the \(y\)-axis as the dependent variable. Your fitted line will then have the form \(\hat{y} = a + bx\), where \(\hat{y}\) is the predicted cost and \(x\) is the distance.

Try It Now 11.7.4

Your first four classmates report these pairs (distance in miles, cost in dollars): (3, 60), (10, 95), (5, 55), (15, 130). Before plotting anything, estimate by eye whether the pattern so far looks positive or negative, and explain what a positive pattern would mean in plain English about students and spending.

Solution

Reading the pairs left to right, the costs climb as the distances grow: 3 miles goes with $60, 10 miles with $95, 15 miles with $130. The one mild wobble is (5, 55), which sits slightly below its neighbors' trend, but the overall direction is clearly upward. So the pattern looks positive. In plain English, a positive pattern means students who live farther from campus tend to spend more on supplies this term — each additional mile of distance is associated with a higher predicted cost. It does not prove that distance causes the spending; it only says the two move together in this sample.

11.7.3 Analyze the Data

Enter your data into your calculator or computer. Write the linear equation, rounding to four decimal places.

Your calculator's regression command (on a TI-83/84, STATCALCLinReg(a+bx)) returns three numbers you care about: the intercept \(a\), the slope \(b\), and the correlation coefficient \(r\). The fitted line has the form

$$\hat{y} = a + bx$$

where \(\hat{y}\) is the predicted cost of supplies and \(x\) is the distance from school. The slope \(b\) tells you how much the predicted cost changes for each additional mile a student lives from campus. The intercept \(a\) is the predicted cost for a student who lives zero miles away — which may or may not make sense in the real world, but the line still needs it.

The correlation coefficient \(r\) measures how tightly the points hug a straight line. It always falls between \(-1\) and \(+1\). Values near \(+1\) mean a strong positive straight-line relationship (farther away, higher cost); values near \(-1\) mean a strong negative one; values near 0 mean little or no straight-line pattern at all.

Reading r like a thermostat

Think of \(r\) as a dial from \(-1\) to \(+1\). At \(+1\) all eight dots sit exactly on one rising line; at 0 they form a shapeless cloud. Most real data lands somewhere in between, and the closer to an endpoint, the more confidently the line describes the data.

Before you trust a correlation, check whether it is significant — that is, whether it is large enough that it probably did not happen by pure chance in a sample of only eight people. Compare your computed \(r\) against a critical value from a correlation critical-values table (using \(n = 8\), so degrees of freedom \(= n - 2 = 6\)) at your course's chosen significance level. If \(|r|\) exceeds the critical value, you have evidence of a genuine linear relationship; if not, the pattern you see could easily be luck.

  1. Calculate the following:

a. \(a = \_\_\_\_\)

b. \(b = \_\_\_\_\)

c. correlation \(= \_\_\_\_\)

d. \(n = \_\_\_\_\)

e. equation: \(\hat{y} = \_\_\_\_\)

f. Is the correlation significant? Why or why not? (Answer in one to three complete sentences.)

For part (f), name the critical value you compared against, state whether your \(|r|\) beat it, and finish with a plain-English conclusion about distance and cost.

  1. Supply an answer for the following scenarios:

a. For a person who lives eight miles from campus, predict the total cost of supplies this term:

b. For a person who lives eighty miles from campus, predict the total cost of supplies this term:

Substitute \(x = 8\) into your equation for part (a), and \(x = 80\) for part (b). Then pause on part (b): eighty miles is almost certainly outside the range of distances you actually collected. Predictions far outside your data range are called extrapolation, and they deserve suspicion — the straight-line pattern you measured nearby may not continue that far out.

  1. Obtain the graph on your calculator or computer. Sketch the regression line.

Figure 11.7.2 — Grid for sketching the scatter plot and regression line.

Try It Now 11.7.5

Using the same fitted line from Example 11.7.1, \(\hat{y} = 45.2000 + 3.7500x\), predict the supply cost for a student who lives eighty miles from campus. Then give one reason your class should treat this particular prediction with caution.

Solution

Step 1 — Substitute \(x = 80\):

$$\hat{y} = 45.2000 + 3.7500(80)$$

Step 2 — Multiply: \(3.7500 \times 80 = 300.0000\).

Step 3 — Add the intercept:

$$\hat{y} = 45.2000 + 300.0000 = 345.2000$$

Answer: The line predicts $345.20 in supplies for a student living eighty miles away.

Why to be cautious: unless your class actually sampled someone living near eighty miles out, this prediction is extrapolation — the line was built from data inside a much smaller range of distances, and there is no guarantee the same straight-line trend continues that far from campus. Real-world costs also cannot grow linearly forever.

Example 11.7.1: Making a Prediction from a Fitted Line

Once your class has computed its equation, turning it into a prediction is simple substitution. Suppose your group's analysis produced this fitted line (your numbers will differ):

$$\hat{y} = 45.2000 + 3.7500x$$

where \(\hat{y}\) is the predicted supply cost in dollars and \(x\) is the distance from campus in miles. Predict the supply cost for a student who lives eight miles from campus.

Solution

Step 1 — Identify the input: the student lives \(x = 8\) miles from campus.

Step 2 — Substitute into the equation:

$$\hat{y} = 45.2000 + 3.7500(8)$$

Step 3 — Multiply the slope by the distance:

$$3.7500 \times 8 = 30.0000$$

Step 4 — Add the intercept:

$$\hat{y} = 45.2000 + 30.0000 = 75.2000$$

Answer: The line predicts a supply cost of $75.20 for a student living eight miles from campus. Notice how the slope earned its keep: each mile adds $3.75 to the prediction, and eight miles adds \(8 \times \$3.75 = \$30.00\) on top of the baseline $45.20.

Try It Now 11.7.6

Suppose your calculator reports \(a = 38.4120\), \(b = 2.9150\), and \(r = 0.42\) for your class's eight data points. Write the fitted equation, interpret the slope in a complete sentence, and decide whether the correlation is significant at the 0.05 level given that the critical value for \(n = 8\) is approximately 0.707.

Solution

Equation: substituting the reported values into \(\hat{y} = a + bx\) gives

$$\hat{y} = 38.4120 + 2.9150x$$

Slope interpretation: each additional mile a student lives from campus adds about $2.92 to the predicted supply cost for the term.

Significance: compare \(|r| = 0.42\) against the critical value 0.707. Since \(0.42 < 0.707\), the correlation is not significant at the 0.05 level. With only eight data points, a correlation this size could easily arise from chance alone, so you cannot claim strong evidence of a genuine linear relationship between distance and cost — even though the slope is positive and the line still gives you a best available prediction.

11.7.4 Discussion Questions

Answer each question in complete sentences, working as a group and citing your actual numbers.

  1. Answer each question in complete sentences.

a. Does the line seem to fit the data? Why?

b. What does the correlation imply about the relationship between the distance and the cost?

For (a), look at your sketch in Figure 11.7.2: do the dots cluster close to the line, or do several swing far above and below it? For (b), connect the sign and size of your \(r\) to plain English — a positive \(r\) means students farther from campus tend to spend more; a negative \(r\) means they tend to spend less; an \(r\) near zero means distance tells you almost nothing about spending.

  1. Are there any outliers? If so, which point is an outlier?

An outlier is a point that sits far from the general pattern of the rest of the data — either far from the line vertically or far from the other \(x\)-values horizontally. Scan your scatter plot for any single dot that looks like it belongs to a different dataset.

  1. Should the outlier, if it exists, be removed? Why or why not?

There is no automatic yes here. Removing a data point just because it is inconvenient throws away real information — a student who spent unusually much may have a good reason (an expensive art-supply list, a lost calculator replaced mid-term). Report the analysis both ways if you remove anything, and justify the removal with a stated reason, not just "it made \(r\) look better."

Try It Now 11.7.7

Suppose one classmate lives 25 miles from campus and spent $400 on supplies, while the other seven data points all lie between 2 and 12 miles with costs between $40 and $120. Identify the outlier and explain, in complete sentences, what makes it unusual and what you would need to check before deciding whether to exclude it.

Solution

The point (25 miles, $400) is the outlier. It is unusual in both directions: its distance (25 miles) lies far beyond the range of the other seven points (2–12 miles), and its cost ($400) sits well above the others ($40–$120). Because it is extreme in \(x\) as well as \(y\), it can drag the slope and intercept substantially and inflate or deflate \(r\).

Before excluding it, check: (1) Is the data entry correct — did the student really spend $400, or was a digit mistyped? (2) Is there a legitimate explanation for the value (for example, a costly program requirement)? If the value is a verified, honest measurement, the defensible move is to report the analysis with the point included, and optionally show how the line changes without it — not to quietly delete it.

Problem Set 11.7

Problem 1. Name the independent and dependent variables in a study of distance from school and the cost of school supplies, and justify the assignment.

Solution

Step 1 — Identify the direction of prediction: the natural question is "given how far a student lives from school, what do they spend on supplies?" We want to predict cost from distance, not the reverse.

Step 2 — Assign the variables: the variable that does the influencing goes on the horizontal axis as the independent variable, and the influenced variable goes on the vertical axis as the dependent variable.

Answer: The independent variable is distance from school (\(x\)), because it is the explanatory factor we can observe and use for prediction. The dependent variable is cost of school supplies (\(y\)), because we suspect spending responds to (or is at least predicted by) distance. The justification is cause-and-effect logic: living farther away plausibly drives extra costs (gas, campus meals), whereas spending money cannot change where someone lives.

Problem 2. Explain why a scatter plot should be drawn before any line is fitted.

Solution

Step 1 — Check that a line is appropriate: a scatter plot shows whether the points actually follow a roughly straight-line pattern before any line is computed.

Step 2 — Spot problems early: the plot reveals curvature (where a straight line would be the wrong model), outliers (points that could distort the fit), and clusters or gaps in the data.

Step 3 — Confirm direction and strength: the plot also gives a first visual read on whether the relationship is positive or negative and how strong it looks.

Answer: A scatter plot should be drawn first because regression assumes a linear relationship; the plot lets you verify that assumption, detect outliers and nonlinearity, and get an initial sense of direction and strength before trusting the calculator's fitted line.

Problem 3. A regression gives \(a = 14.2\) and \(b = 0.63\). Write the equation of the line of best fit.

Solution

Step 1 — Recall the form of the fitted line: the line of best fit has the equation \(\hat{y} = a + bx\), where \(a\) is the intercept and \(b\) is the slope.

Step 2 — Substitute the given values: with \(a = 14.2\) and \(b = 0.63\),

$$\hat{y} = 14.2 + 0.63x$$

Answer: \(\hat{y} = 14.2 + 0.63x\)

Problem 4. Using the equation from 11.7.3, predict the value of \(y\) when \(x = 12\).

Solution

Step 1 — Start from the fitted line: using \(\hat{y} = 14.2 + 0.63x\) from problem 11.7.3.

Step 2 — Substitute \(x = 12\):

$$\hat{y} = 14.2 + 0.63(12)$$

Step 3 — Multiply the slope:

$$0.63 \times 12 = 7.56$$

Step 4 — Add the intercept:

$$\hat{y} = 14.2 + 7.56 = 21.76$$

Answer: When \(x = 12\), the line predicts \(y = 21.76\).

Problem 5. A study of 10 students gives \(r = 0.71\); the critical value for \(n = 10\) is 0.632. Is the correlation significant? State the decision.

Solution

Step 1 — State the decision rule: the correlation is significant if the absolute value of \(r\) exceeds the critical value; otherwise it is not.

Step 2 — Compare the values: here \(|r| = |0.71| = 0.71\) and the critical value for \(n = 10\) is 0.632.

Step 3 — Make the comparison:

$$0.71 > 0.632$$

Since \(|r|\) beats the critical value, the correlation is significant.

Answer: Yes, the correlation is significant: because \(|r| = 0.71\) exceeds the critical value of 0.632, we have evidence of a genuine linear relationship between the variables.

Problem 6. Explain what it would mean for this study if the correlation turned out not to be significant.

Solution

Step 1 — Interpret "not significant": a non-significant correlation means the observed \(r\) was small enough that chance alone, in a sample of this size, could easily have produced it.

Step 2 — Draw the conclusion about the study: we would fail to find convincing evidence of a real linear relationship between distance from school and supply cost in this sample.

Step 3 — Note what still holds: the fitted line remains the best available straight-line summary and predictor, but its slope should not be treated as describing a reliable underlying trend.

Answer: If the correlation were not significant, it would mean the apparent pattern between distance and cost could plausibly be due to random sampling variation rather than a genuine relationship — so we could not claim that distance meaningfully predicts supply cost, even though the line still provides a best-fit prediction tool.

Problem 7. A sample covers distances from 1 to 15 miles. Explain whether the line should be used to predict at 40 miles.

Solution

Step 1 — Compare the target to the data range: the sample covers distances from 1 to 15 miles, but 40 miles lies well outside that interval.

Step 2 — Apply the extrapolation principle: predictions far outside the observed range assume the straight-line trend continues beyond where it was measured, which cannot be verified from the data.

Step 3 — Consider practical limits: costs also cannot grow linearly forever, so the trend almost certainly bends eventually.

Answer: No — predicting at 40 miles would be extrapolation, since 40 miles lies far outside the sampled range of 1 to 15 miles. The line should not be used there without additional data, because there is no evidence the linear pattern continues that far out.

Problem 8. Write a practical interpretation of a slope of 0.63 in this context.

Solution

Step 1 — Recall what the slope measures: the slope \(b\) is the predicted change in \(y\) for each one-unit increase in \(x\).

Step 2 — Apply it to this context: here \(x\) is distance from school in miles and \(y\) is supply cost, so each additional mile adds 0.63 units to the predicted cost.

Answer: For every additional mile a student lives from school, the predicted cost of supplies increases by 0.63 (dollars). For example, a student living 5 miles farther away is predicted to spend about $3.15 more on supplies than a student closer in.

Problem 9. One student lives 2 miles from school and spends far more than the line predicts. State what this point is called and how you would decide what to do with it.

Solution

Step 1 — Name the point: a point that sits far from the general pattern of the rest of the data is called an outlier.

Step 2 — Investigate before acting: check whether the value is correct (a data-entry error?) and whether there is a legitimate explanation for the unusually high spending.

Step 3 — Decide how to handle it: if the value is a verified, honest measurement, keep it in the analysis; removing data just because it is inconvenient discards real information. It is reasonable to report the analysis both with and without the point to see how much influence it has, provided the reason for removal is stated.

Answer: The point is called an outlier. I would first verify the data entry and look for a legitimate explanation; only if the value were confirmed erroneous would I remove it — otherwise I would keep it (possibly reporting results both ways) rather than delete it merely because it makes the fit look worse.

Problem 10. Explain why the y-intercept of this regression may or may not have a sensible interpretation, and what decides it.

Solution

Step 1 — Recall what the intercept represents: the y-intercept \(a\) is the predicted value of \(y\) when \(x = 0\).

Step 2 — Ask whether \(x = 0\) is meaningful here: \(x = 0\) means a student who lives zero miles from school — essentially on campus.

Step 3 — Decide based on the data range: if the sampled distances include values near zero, the intercept describes a realistic case and has a sensible interpretation (the baseline supply cost for a student living at school). If all sampled students live several miles out, the intercept is an extrapolation to a condition never observed, and it may be meaningless even though the line mathematically requires it.

Answer: The intercept may or may not make sense depending on whether \(x = 0\) falls within (or near) the range of observed distances. What decides it is the data: if students living essentially on campus are represented in the sample, the intercept is interpretable as their predicted cost; if not, it is an unverified extrapolation with no practical meaning.

Key Terms

Summary

In this lab you collected eight pairs of bivariate data, chose the independent and dependent variables, plotted the scatter diagram, and used technology to compute the intercept \(a\), the slope \(b\), the correlation \(r\), and the fitted equation \(\hat{y} = a + bx\). You tested whether the correlation was significant by comparing \(|r|\) to a critical value, used the line to predict supply costs at eight and eighty miles, and discussed goodness of fit, outliers, and whether an outlier should stay in the analysis. You can now carry out the full regression workflow on any two-variable dataset — and you know which parts of the output deserve skepticism.