Lesson 1: The least-squares line
Fit a least-squares line to used-car prices
SkillFitting a least-squares line
Worked example
A Brisbane car dealer lists the age and price of ten used Toyota Corollas.
| Age (years) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Price ($'000) | 31.5 | 27.8 | 28.4 | 23.0 | 24.1 | 19.6 | 18.9 | 17.5 | 13.2 | 14.6 |
Use technology to determine the equation of the least-squares line that can be used to predict price from age. Give the slope and intercept correct to two decimal places.
Step 1: Identify the variables
We predict price from age, so age is the explanatory variable () and price is the response variable ().
The variable you predict from always goes in the list; swapping the lists gives a different line.
Step 2: Enter the data and run the linear regression
In paired-variable statistics mode (), enter the ages in the list and the prices in the list. Check that .
Step 3: Read off the slope and intercept
The calculator gives (the slope) and (the intercept). It also gives .
Step 4: Write the equation in context
with price in thousands of dollars and age in years.
Step 5: Check with the mean point
The mean age is and the mean price is . Using the unrounded values, . ✓
The least-squares line always passes through , so this catches a swapped slope and intercept.
Answer
, with price in thousands of dollars and age in years.
Try a similar one
A fresh question of the same kind, checked as you answer, with hints and a full solution.
Method
Decide which variable is explanatory; it goes in the list.
Run the regression: is the slope, the intercept.
Round as asked and write the equation with the variable names and units.
Watch out for
Writing by mixing up the calculator's and .
Leaving the answer as without saying what and are.