Porisma

Correlation and linear regression

Learn one idea at a time

Choose a unit. Each has worked examples and practice.

  1. Read correlation with the scatter

    Calculate linear correlation and check the scatter and outliers.

  2. Choose the response and fit a line

    Distinguish the two regression directions and their residuals.

  3. Predict in the right direction

    Choose the regression line from the modelling setup and check the prediction range.

  4. Transform variables and compare models

    Track units and signs, then linearise a nonlinear relationship.

Read or print the complete chapter

By the end, you can

  • Use scatterplots before fitting a line
  • Interpret correlation without claiming causation
  • Distinguish interpolation, extrapolation and transformed models

4 focused units · about 40 minutes for the full chapter. Allow extra time for practice.

The central idea

Correlation describes linear association, while a regression line predicts a response from an explanatory variable. The least-squares line minimises squared vertical residuals. A strong association does not establish causation. Prediction beyond the observed input range is extrapolation; transformations can reveal a relationship hidden in the original coordinates.

Begin with paired observations

The notes ask about links between GenAI use and examination scores, and between temperature and rainfall intensity. These are questions to investigate, not established conclusions. In the source’s controlled experiment, vary the slope angle through 10∘,20∘,30∘,40∘,50∘10^\circ,20^\circ,30^\circ,40^\circ,50^\circ and record a ball’s travel time. The angle is the independent (explanatory) variable, and the travel time is the dependent (response) variable.

When control is impractical, the source proposes observing temperature and sea level each day over ten years. This is observational data collection. The notes use “natural experiments” broadly here; an observational study is not automatically a natural experiment with an externally imposed change. Controlled studies are possible in some settings even in fields mentioned by the source; identify what is actually controlled in the particular investigation.

Bivariate data consist of ordered pairs (x1,y1),…,(xn,yn)(x_1,y_1),\ldots,(x_n,y_n), such as each person’s age and salary. Each pair must refer to the same observation. The explanatory variable supplies the basis for prediction or study; the response is the outcome observed or predicted. In an observational study the explanatory variable need not be manipulated. Calling a variable “independent” in this role does not assert statistical independence of X and Y.

Try the five source situations before opening their working.

Inspect a scatter diagram

A scatter diagram plots the paired numerical observations, usually with the explanatory variable on the horizontal x-axis and the response on the vertical y-axis. The notes also call it a scatter plot, scatter graph or scatter chart. Inspect:

  • Shape: approximately linear, curved (such as the source’s inverted U), or another pattern (such as its loop).
  • Direction for a linear pattern: positive/direct means y tends to rise with x; negative/inverse means y tends to fall with x. “Inverse” here describes direction, not a proved reciprocal formula y=k/xy=k/x.
  • Strength of the linear pattern: tight clustering about a line is stronger than a widely scattered cloud. A strong curved pattern need not have strong linear correlation.

All eight schematic panels from the opening notes are reconstructed in the accompanying figure: three shape examples, two direction examples and three strength examples. They are illustrations, not measured numerical data.

The source uses numerical variables such as height, mass, rates and counts. It contrasts beauty and happiness as not directly numerical. Such concepts can be studied using explicitly defined numerical scores, but a score’s meaning and measurement quality need justification; merely assigning category numbers does not establish a quantitative scale.

For the linear correlation studied here, the source’s sequence is sketch the scatter diagram, then find the correlation coefficient. Plotting first can reveal curvature or unusual observations hidden by a single summary number.

Transfer a calculator plot to a clear sketch

Retain all five source pointers:

  1. Check the window scale: the origin may not be visible.
  2. Label both axes and put the explanatory variable horizontally, response vertically.
  3. Mark the minimum and maximum x and y values.
  4. Match the number of observations with the number of plotted dots or crosses. Coincident pairs can overlap, so record their multiplicity if needed.
  5. Preserve relative positions accurately. Graph paper is unnecessary unless requested.

Example 1 retains every data pair and the complete six-step calculator route before describing the observed pattern.

Open the chapter exploration

Worked example

For (1,1),(2,2),(3,2),(4,5)(1,1),(2,2),(3,2),(4,5), both sample means are 2.5. A calculator gives y=−0.5+1.2xy=-0.5+1.2x for y on x and x=5/6+(2/3)yx=5/6+(2/3)y for x on y, with r≈0.8944r\approx0.8944. The first minimises squared y residuals and the second squared x residuals. At y=3, the reverse fit estimates x as 17/617/6, whereas rearranging the forward line gives 35/1235/12. The different estimates reflect different fitting objectives. These are observational predictions, with the response chosen for the modelling task.

Inspect the scatter, residual direction and modelling setup. A large correlation does not establish causation or justify extrapolation, and rearranging a fit does not generally refit the other response.

Check your understanding

An observational dataset has xˉ=5\bar x=5, yˉ=20\bar y=20, Sxx=20S_{xx}=20, Syy=160S_{yy}=160 and Sxy=40S_{xy}=40, where S denotes centred sums. Observed x values span 2 to 8 and y values span 12 to 28. Find both regression lines. Choose the appropriate fitted line to estimate y when x=7 and x when y=24. Compare the latter estimate with rearranging the other line, and assess a prediction at x=20.

Full mastery checklist
Complete source practice map

Practice questions

31 examples and practice questions, in 6 sections.

Ready to try this on your own?

For “Correlation and linear regression”, try a question without the working and explain your method. This records your confidence, saved in this browser only.

Ready to practise?Chapter practice