Vertex Learn

Choosing a graph, and the line of best fit

What this lesson covers

  • A distribution is formed from all the possible values of a variable and their frequencies. It can be shown using data visualisations that show patterns, trends, and variations and that include dot plots, bar graphs, frequency tables, box plots, histograms, time-series graphs, scatter plots, and two-way tables.
  • A good data visualisation should allow viewers to discern the variable(s) and who the data was collected from, and then, depending on the type of visualisation, additional information such as frequency, proportions, patterns or trends, and units for numerical variables.
  • In relationship investigations: sometimes one variable is thought of as predictive of the other variable; then the response or dependent variable is on the y-axis, and the ‘predictive’, explanatory, or independent variable is on the x-axis an eyeballed line or curve of best fit can be added for paired numerical data.
Key idea

A graph is not decoration

  • It is the picture of a distribution.
  • So which graph you draw is decided by the data.
  • Not by which one you find easiest to draw.
Key idea

What a distribution actually is

  • All the values your variable took.
  • Together with how often each one happened.
  • That pairing is the distribution. A graph shows it.
PartDetailNote
All the valuesthat the variable took
With their frequencieshow often each one happened
Togetherthat is the distribution
A graphis a picture of itnot a decoration
Key idea

The kind of variable picks the graph

  • One categorical variable: a bar graph.
  • One numerical: a dot plot, a histogram, or a box plot.
  • Two numerical and paired: a scatter plot.
What you haveWhat to drawExample
One categoricalbar graphsport, year level
One numericaldot plot, histogram, box plotheight, score
Two numerical, pairedscatter plothours against score
Numerical over timetime-series graphrainfall by month
Two categoricaltwo-way tablesport by year level
Key idea

Why the wrong graph loses information

  • Draw heights as a bar graph and each height becomes a category.
  • You have thrown away the order, and the spacing.
  • 150 is nearer 152 than 180, and a bar graph cannot say so.
ChoiceWhat happensNote
Bar graph of heightstreats each height as a category
What is lostthe order and the gaps
Numbers have spacing150 is closer to 152 than to 180
A dot plot keeps itso use that
Key idea

What a reader must be able to work out

  • What was measured, and who it was measured on.
  • The units, for anything numerical.
  • A graph that needs you there to explain it has failed.
Must showMeaningWhere
The variablewhat was measuredaxis label
The groupwho it was measured ontitle
The unitsfor anything numericalcm, minutes, dollars
The frequenciesor the patterndepends on the graph
Key idea

And usually you draw more than one

  • A dot plot shows every individual value.
  • A box plot shows the quartiles from last lesson.
  • Different graphs of the same data answer different questions.
Worked example

Choosing a scale

  • Data from 60 to 82 on an axis running to 1000 is a stripe.
  • Run the axis from 60 to 85 and you can read it.
  • Cover your data, with a little room. That is the whole rule.
DataAxisResult
Data runs 60 to 82an axis of 0 to 1000everything in a stripe
Same dataan axis of 60 to 85, steps of 5readable
Rule of thumbcover the data, with a little room
Key idea

Try it: let the data choose

Key idea

Now the scale trick worth knowing about

  • Two values: 100 and 105. A rise of five percent.
  • Start the axis at zero and the bars look nearly identical.
  • Start it at 95 and the second bar is twice the height.
VersionWhat it looks likeVerdict
Two values: 100 and 105a rise of 5%
Axis from 0the bars look almost the samehonest
Axis from 95the second bar is twice the firstmisleading
Nothing was fakedthe numbers are identical
Key idea

Try it: the scale trick

Key idea

And nothing was faked

  • Both graphs plot exactly the same two numbers.
  • The data is honest and the picture is not.
  • Which is why you check the axis before believing a graph.
Worked example

Two paired variables: a scatter plot

  • Hours studied and test score, for eight students.
  • Each student is one dot: their hours across, their score up.
  • And the cloud clearly slopes upward.
Two paired variables: a scatter plot
Key idea

Which variable goes on which axis

  • The explanatory variable goes across the bottom.
  • The response variable goes up the side.
  • Ask: which of the two could plausibly affect the other?
AxisVariableHere
x-axisthe explanatory variablehours studied
y-axisthe response variabletest score
The testwhich could affect the other?
Study affects scorenot the other way round
Key idea

That test works because the arrow only points one way

  • Studying longer could change your score.
  • Your score cannot reach back and change how long you studied.
  • So hours is explanatory, and it goes on x.
HoursScoreHoursScore
1 hour605 hours72
2 hours646 hours76
3 hours667 hours78
4 hours708 hours82
Key idea

The line of best fit is drawn by eye

  • That is not a shortcut. It is the method at this level.
  • Through the middle, with about as many points above as below.
  • It will miss most of the points, and that is correct.
Rule
Through the middle of the cloud
Roughly as many above as below
It will miss most of the pointsthat is correct
Do not join the dotsthat is a different, wrong thing
Key idea

Try it: drag the points

Worked example

And then you use it to predict

  • What score might five and a half hours give?
  • Up from 5.5 to the line, then across. About 74.
  • Check it is sensible: between the 72 and the 76. It is.
StepWorkingNote
Questionwhat score for 5.5 hours?
Go up from 5.5to the line, then across
Read offabout 74
Sensible?between 72 and 76yes
Summary

What to take away

  • Six things, and the fourth one you will see in the news.
A distributionis the values and how often each occurred
The graphis chosen by the kind of variable, not by taste
Every graph needsthe variable, the group, and the units
A y-axis not starting at zeroexaggerates the difference
The explanatory variablegoes on x, the response on y
A line of best fitis drawn by eye and misses most points

Common mistakes

  • Heights drawn as a bar graph with one bar per height.
    Height is numerical, so use a dot plot, histogram or box plot, which keep the order and spacing of values.
  • Score on the x-axis and hours studied on the y-axis.
    The explanatory variable (hours) goes on the x-axis and the response (score) on the y-axis.
  • The line of best fit must go through the first and last points.
    An eyeballed line follows the trend with about as many points above it as below; it need not touch any point.
  • Starting the y-axis at 95 just shows more detail.
    A y-axis that does not start at 0 can make a 5% change look like a doubling; start at 0 or mark the break clearly.

Your turn

  • Try all eight.
1

Favourite sport per student. Which graph?

2

Sleep and reaction time. Graph? Which axis?

3

Bars of 100 and 105, axis from 95. Wrong?

4

Should a line of best fit pass through every point?

5

A survey records each student's favourite sport and year level. Which display shows both together?

6

Heights in a class run from 148 cm to 176 cm. Which axis suits a dot plot of them?

7

A dot plot is titled "Our results" and its axis is labelled only "Time". What is missing?

8

A line of best fit for hours studied (x) against score (y) passes through (2, 30) and (6, 50). Predict the score for 4 hours.

Show answer

1. A bar graph. Favourite sport is one categorical variable. 2. A scatter plot, because they are two paired numerical variables. Hours slept goes on x, since sleep could affect reaction time, and reaction time goes on y. 3. The difference is only 5 percent, but starting at 95 makes the second bar look twice as tall. The numbers are honest and the picture is not. 4. No. It should pass through the middle of them, with roughly as many above as below, and it will miss nearly all of them. Joining the dots is a different thing and it is not a line of best fit. 5. A two-way table. Both variables are categorical, so a two-way table counts each pair. 6. 145 cm to 180 cm, in steps of 5. It covers every value from 148 to 176 with a little room; the other axes leave some heights off. 7. Who was measured, and the units of time. A reader cannot tell the group or whether it is seconds, minutes or hours. 8. 40. The line rises 20 over 4 hours, which is 5 per hour, so from (2, 30) two more hours gives 30 + 10 = 40.

Worked example

The answers

  • Favourite sport is one categorical variable.
  • Sleep could affect reaction time, not the reverse.
  • A line of best fit misses most points.
Answer
1A bar graph
2Scatter, sleep on x
3The axis exaggerates
4No
Try it

Least-Squares Regression

Full screen · PhET Interactive Simulations, University of Colorado Boulder, CC BY 4.0

Challenge

1

Sixteen students at a Napier school recorded their trip to school, in whole minutes: 4, 5, 6, 6, 7, 7, 8, 9, 12, 15, 16, 17, 17, 18, 19, 20. (a) Ana draws a histogram with intervals 0 to 9, 10 to 19 and 20 to 29 minutes. Find the three bar heights. (b) Ben draws one with intervals 0 to 4, 5 to 9, 10 to 14, 15 to 19 and 20 to 24. Find the five bar heights. (c) Find the mean trip time, and count how many students are within 2 minutes of it. (d) Which histogram gives the truer picture, and what feature of the data does the other one hide?

Hint

Same data, two pictures. Sketch both and look at where the values bunch up. Then ask how typical the mean really is.

Answer

(a) 8, 7, 1. (b) 1, 7, 1, 6, 1. (c) Mean 11.625 minutes, and only 1 student (12 minutes) is within 2 minutes of it. (d) Ben's. It shows two clusters, around 5 to 9 and around 15 to 19 minutes (perhaps walkers and bus riders), with a gap between them. Ana's wide bars merge the groups and make 10 to 19 minutes look typical, when almost nobody takes 10 to 14.

Step by step
  1. Count the values in each interval for both histograms.
  2. Ana's bars fall steadily, so the data looks like one group with most trips under 20 minutes.
  3. Ben's bars have two tall peaks with a dip in between, so there are two separate groups.
  4. The mean sits right in the gap: only one student is close to it.
  5. A graph is chosen to show the distribution, and bars that are too wide can hide its shape. A dot plot of all 16 values would show the two clusters too.
Full working
  1. 0 to 9: 4, 5, 6, 6, 7, 7, 8, 9 → 8Ana's first bar
  2. 10 to 19: 12, 15, 16, 17, 17, 18, 19 → 7; 20 to 29: 20 → 1Ana's other bars
  3. Ben: 0 to 4 → 1; 5 to 9 → 7; 10 to 14 → 1; 15 to 19 → 6; 20 to 24 → 1narrower intervals
  4. Total = 186, mean = 186 ÷ 16 = 11.625add, then divide
  5. Within 2 minutes means 9.625 to 13.625: only 12 → 1 studentthe mean is in the gap
  6. Ben's histogram: two clusters with a gap, hidden by Ana's wide bars
2

A histogram shows the heights of 20 Year 9 students, measured to the nearest whole centimetre. The bars are 145 to 149 cm: 2 students, 150 to 154 cm: 5, 155 to 159 cm: 8, 160 to 164 cm: 4, 165 to 169 cm: 1. The raw data has been lost. (a) What are the smallest and largest possible values of the range? (b) What are the smallest and largest possible values of the mean? Could the mean be 159 cm? (c) Between which two heights must the median lie? (d) Tama says, "The tallest student is 169 cm." Is that a fair conclusion from the graph?

Hint

Each student could be anywhere inside their bar. To push a value to its extreme, put every student at the bottom of their bar, or every student at the top.

Answer

(a) Range at least 16 cm and at most 24 cm. (b) Mean at least 154.25 cm and at most 158.25 cm, so it cannot be 159 cm. (c) The median is between 155 and 159 cm. (d) No: the tallest student could be any height from 165 to 169 cm.

Step by step
  1. A histogram keeps how many values fall in each interval but throws away the exact values.
  2. The range is smallest when the shortest student is as tall as possible (149) and the tallest as short as possible (165).
  3. The range is largest with the shortest at 145 and the tallest at 169.
  4. Putting every student at the bottom of their bar gives the lowest possible mean, and at the top the highest. Each top is 4 cm above its bottom, so the means differ by 4.
  5. The 10th and 11th heights decide the median, and counting up the bars puts both in 155 to 159.
  6. The graph only says the tallest is somewhere from 165 to 169, so Tama is claiming more than the picture shows.
Full working
  1. Smallest range = 165 − 149 = 16shortest high in bar 1, tallest low in bar 5
  2. Largest range = 169 − 145 = 24opposite ends
  3. Lowest total = 2×145 + 5×150 + 8×155 + 4×160 + 1×165 = 3085everyone at the bottom of their bar
  4. Lowest mean = 3085 ÷ 20 = 154.25total over count
  5. Highest total = 3085 + 20 × 4 = 3165, mean = 3165 ÷ 20 = 158.25everyone 4 cm higher
  6. 159 > 158.25, so a mean of 159 cm is impossibleoutside the possible values
  7. Running totals 2, 7, 15: the 10th and 11th are in 155 to 159median of 20 values
  8. Range 16 to 24 cm, mean 154.25 to 158.25 cm, median 155 to 159 cm; Tama is wrong
3

Eight netballers in a Rotorua team recorded practice hours per week (h) and goals scored out of 20 shots (g): (1, 6), (2, 9), (3, 9), (4, 12), (5, 13), (6, 13), (7, 17), (8, 18). The coach wants a line of best fit of the form g = 1.5h + c, with exactly 4 points above it, 4 below it and none on it. (a) Which variable goes on which axis? (b) For which values of c does the coach's line work? (c) Her assistant tries lines of the form g = 2h + c instead. Show that no value of c gives 4 above, 4 below and none on the line. (d) Using a line from (b), predict the goals for a player who practises 4.5 hours a week.

Hint

For each point work out g − 1.5h. The point is above the line exactly when this number is bigger than c. Then think about where c must sit in the sorted list.

Answer

(a) Practice hours on the x-axis (explanatory), goals on the y-axis (response). (b) Any c between 5.5 and 6, not including 5.5 or 6. (c) The values of g − 2h are 4, 5, 3, 4, 3, 1, 3, 2, and three of them are 3, which is exactly where c would have to sit. (d) Between 12.25 and 12.75 goals, so about 12 or 13 goals out of 20.

Step by step
  1. Practice could affect goals, not the other way round, so hours go across and goals go up.
  2. A point is above g = 1.5h + c when g − 1.5h is bigger than c, and below when it is smaller.
  3. Sorted, the values of g − 1.5h are 4, 4.5, 4.5, 5.5, 6, 6, 6, 6.5. To split them 4 and 4, c must be above 5.5 and below 6.
  4. For slope 2 the sorted values are 1, 2, 3, 3, 3, 4, 4, 5. The 4th and 5th are both 3, so a split of 4 and 4 needs c above 3 and below 3 at once.
  5. With c just under 3 there are 6 above; with c just over 3 only 3; with c = 3 three points sit on the line.
  6. Using any working line, the prediction at 4.5 hours is 6.75 + c, which lies between 12.25 and 12.75.
Full working
  1. g − 1.5h: 6 − 1.5 = 4.5, 9 − 3 = 6, 9 − 4.5 = 4.5, 12 − 6 = 6first four players
  2. 13 − 7.5 = 5.5, 13 − 9 = 4, 17 − 10.5 = 6.5, 18 − 12 = 6last four players
  3. Sorted: 4, 4.5, 4.5, 5.5, 6, 6, 6, 6.5c must fall between the 4th and 5th
  4. So 5.5 < c < 6strictly, so no point is on the line
  5. g − 2h: 4, 5, 3, 4, 3, 1, 3, 2 → sorted 1, 2, 3, 3, 3, 4, 4, 5the 4th and 5th are both 3
  6. c just under 3 gives 6 above, c over 3 gives at most 3 above, c = 3 puts 3 points on the linenever 4 and 4
  7. g = 1.5 × 4.5 + c = 6.75 + c, between 12.25 and 12.75interpolation, inside the data
  8. About 12 or 13 goals; c must satisfy 5.5 < c < 6

More challenge problems

Science

Where science uses this

Worksheet with answersWithout answersDownload PDF
Report a mistake

More in Statistics

Is your child on track?

Take the free placement test