Suppose you run a snack stand at a summer sports field. Some days you sell 50 cold drinks, some days 140. You suspect the weather matters, so for 10 days you record two numbers: the high temperature and the number of drinks sold. Now each day gives a pair of values, and the question is no longer "what is typical?" but "how does one quantity change as the other changes?" That is two-variable data, and the first tool for it is a picture: the scatter plot. If the points form a clear pattern, you can describe it with an equation and use that equation to plan how much stock to buy tomorrow.
Variables and scatter plots
The independent variable is the one you think does the influencing, or the one you choose or measure first; it goes on the horizontal -axis. The dependent variable is the one you think responds; it goes on the vertical -axis. Here, temperature is independent and drinks sold is dependent: the weather might change sales, but sales cannot change the weather. Each day becomes one point . A scatter plot does not join the points with lines, because the days are separate observations.
| Day | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| High temperature x (°C) | 14 | 16 | 18 | 20 | 21 | 23 | 25 | 27 | 29 | 31 |
| Drinks sold y | 45 | 58 | 62 | 78 | 80 | 95 | 104 | 120 | 128 | 145 |
Describing correlation: direction, strength, form
Correlation describes how two variables move together. Describe it in three parts. Direction: positive if tends to increase as increases (points rise to the right), negative if tends to decrease (points fall to the right), and none if there is no overall trend. Strength: strong if the points cluster tightly around a line or curve, weak if they are loosely scattered. Form: linear if the pattern follows a straight line, non-linear if it bends. Graphing technology also reports the correlation coefficient , a number from to that measures how close the points are to a straight line: values near mean strong positive linear correlation, near strong negative, and near little or no linear correlation. The drink data gives : strong, positive and linear.
Drawing a line of best fit
When the correlation is linear, a line of best fit summarizes the trend. To draw one by eye: follow the direction of the points, put roughly as many points above the line as below it along its whole length, and pass through the middle of the cloud. The line does not have to pass through any data point. To find its equation , choose two points that lie on your line (easy grid points, far apart), find the slope, then substitute to find . For the drink data, a line drawn by eye passes through and .
The slope has a meaning in context: each extra degree Celsius goes with about 5.8 more drinks sold, on average. Graphing technology finds the line that fits best by a precise rule (least squares) and gives , very close to the line drawn by eye. But not every relationship is a straight line. A graphing tool (such as Desmos or a spreadsheet) can fit a quadratic model when the data rises and falls (or falls and rises) in a U shape, or an exponential model when the values multiply by about the same number each step. Look at the scatter plot first and choose the model whose shape matches; a high for a straight line does not prove the data is linear.
| Model | Shape of the points | Invented data | Equation from technology (rounded) |
|---|---|---|---|
| Linear | Straight trend; y changes by about the same amount for each step in x | Temperature vs drinks sold (table above) | y ≈ 5.8x − 38.5 |
| Quadratic | Rises then falls (or falls then rises) in a U shape | Ball height h (m) at t = 0, 0.5, 1, …, 4 s: 1.5, 11.2, 18.6, 23.4, 26.0, 26.1, 23.8, 19.0, 11.5 | h ≈ −4.9t² + 22.0t + 1.4 |
| Exponential | Values multiply by about the same factor each step; curve gets steeper | Video views on days 0 to 6: 200, 290, 410, 600, 860, 1240, 1780 |
- Predicting inside the range of the data
- Example: drinks sold at 22 °C (data runs 14 °C to 31 °C)
- Usually reliable when the correlation is strong
- Predicting outside the range of the data
- Example: drinks sold at 40 °C
- Risky: the pattern may change where you have no data