Back to homeMathematics · 1st Bach. Science · Change subject
Start for free
BAC1 tech · Mathematics
Bivariate distributions · Bivariate statistics

Non-linear regression and causation

Not every scatter plot follows a straight line. Sometimes it rises and then falls (a parabola), sometimes it speeds up (exponential), and sometimes it slows down (power). For these cases there are two approaches: fit a curve directly, or make a change of variable that turns the curve into a straight line and reuse everything you already know about linear regression.

Before you start, make sure you know: Logarithms (4th ESO)
Before you start, make sure you know: Bivariate distributions (4th ESO)

When a straight line is not the right model

Three scatter plots comparing the shape of a linear cloud of points, a U-shaped quadratic one and an increasing exponential one. linear quadratic (U) exponential
Practice★☆☆Not started
The three scatter plots in the diagram correspond to three different studies. For each of them, indicate which type of model seems most suitable — linear ($y = a + bx$),…

The three scatter plots in the diagram correspond to three different studies. For each of them, indicate which type of model seems most suitable — linear ($y = a + bx$), quadratic ($y = a + bx + cx^2$) or exponential ($y = a \cdot b^x$) — and briefly justify your choice.

x y A x y B x y C
Solve

Linearising an exponential model with logarithms

Practice★★☆Not started
The number of users of an application grows approximately exponentially: $y = a \cdot b^x$, where $x$ is the number of months elapsed. Taking natural logarithms,…

The number of users of an application grows approximately exponentially: $y = a \cdot b^x$, where $x$ is the number of months elapsed. Taking natural logarithms, $\ln y = \ln a + x \cdot \ln b$, so that the pairs $(x, \ln y)$ fit a straight line. The linearised data are:

$x$ (months) $0$ $1$ $2$ $3$
$\ln y$ $1,0$ $1,7$ $2,4$ $3,1$
  1. a) Verify that the four linearised points lie exactly on a straight line and find its equation.
  1. b) Deduce the values of $a$ and $b$ (express $a$ and $b$ as powers of $e$ and approximate them to two decimal places).
  1. c) Estimate the number of users after $6$ months.
Solve
Practice★★★Not started
The area of a lake covered by an invasive plant has been measured over $5$ months: | $x$: month | $1$ | $2$ | $3$ | $4$ | $5$ | |---|---|---|---|---|---| | $y$: area…

The area of a lake covered by an invasive plant has been measured over $5$ months:

$x$: month $1$ $2$ $3$ $4$ $5$
$y$: area ($\text{m}^2$) $3,5$ $7,1$ $14,0$ $28,2$ $56,5$
  1. a) Plot the pairs $(x, \ln y)$, verify that they align reasonably well, and fit a straight line to the linearised data (take $\ln y$ to two decimal places).
  1. b) Write down the corresponding exponential model $y = a \cdot b^x$ and calculate the monthly growth rate as a percentage.
  1. c) Predict the area covered in month $8$ and, given that the lake has $1.500\ \text{m}^2$, comment on the problem presented by extrapolating this model in the long term.
Solve

Linearising a power model

Graph of the power relationship between the length and the period of a pendulum, alongside its corresponding linear transformation using logarithms. T = a·L^(1/2) ln T = ln a + b·ln L
Practice★★☆Not started
In a Physics laboratory, the period $T$ of a pendulum is measured as a function of its length $L$, and a power relationship $T = a \cdot L^b$ is suspected. Taking…

In a Physics laboratory, the period $T$ of a pendulum is measured as a function of its length $L$, and a power relationship $T = a \cdot L^b$ is suspected. Taking logarithms, $\ln T = \ln a + b \cdot \ln L$. The linearised data are:

$\ln L$ $-1,386$ $-0,693$ $0$ $0,693$
$\ln T$ $0$ $0,347$ $0,693$ $1,040$
  1. a) Fit a straight line to the linearised data and write down its equation.
  1. b) Deduce the values of $a$ and $b$.
  1. c) Compare the value obtained for $b$ with that predicted by Physics, $b = \frac{1}{2}$, and comment on the result.
Solve

Quadratic fit by least squares

Scatter plot with curvature comparing the linear fit and the parabolic fit by least squares. regression parabola: minimum among the data
Practice★★☆Not started
It is suspected that the variable $y$ has a quadratic dependence on $x$. Using the five data items in the table | $x$ | $0$ | $1$ | $2$ | $3$ | $4$ |…

It is suspected that the variable $y$ has a quadratic dependence on $x$. Using the five data items in the table

$x$ $0$ $1$ $2$ $3$ $4$
$y$ $5$ $3$ $3$ $5$ $9$

the sums $\sum x_i = 10$, $\sum x_i^2 = 30$, $\sum x_i^3 = 100$, $\sum x_i^4 = 354$, $\sum y_i = 25$, $\sum x_i y_i = 60$ and $\sum x_i^2 y_i = 204$ have been calculated.

  1. a) Set up the system of three equations that the coefficients of the regression parabola $y = a x^2 + bx + c$ must satisfy.
  1. b) Solve it and write down the equation of the quadratic fit.
  1. c) Estimate the value of $y$ for $x = 5$ and comment on the reliability of this prediction.
Solve
Practice★★★Not started
The consumption of an electric car, in $\text{kWh}$ per $100\ \text{km}$, has been measured at different speeds and the data are shown in the figure: | $x$: speed…

The consumption of an electric car, in $\text{kWh}$ per $100\ \text{km}$, has been measured at different speeds and the data are shown in the figure:

$x$: speed ($\text{km/h}$) $40$ $60$ $80$ $100$ $120$
$y$: consumption ($\text{kWh}/100\ \text{km}$) $13,1$ $12,4$ $12,5$ $13,4$ $15,1$
  1. a) Mentally represent (or sketch) the scatter plot and explain why a quadratic model is more suitable than a linear one.
  1. b) Calculate the necessary sums $\sum x_i$, $\sum x_i^2$, $\sum x_i^3$, $\sum x_i^4$, $\sum y_i$, $\sum x_i y_i$, $\sum x_i^2 y_i$ and set up the system for the quadratic fit.
  1. c) Solve the system and write down the equation of the regression parabola (round the coefficients to four decimal places).
  1. d) Find the speed for minimum consumption according to the model and predict the consumption at $140\ \text{km/h}$, assessing the reliability of this prediction.
11 12 13 14 15 16 40 60 80 100 120 speed (km/h) consumption (kWh/100 km) (40; 13,1) (60; 12,4) (80; 12,5) (100; 13,4) (120; 15,1)

You can do it on paper and send a photo with your answer.

Solve

Correlation is not causation

Causal diagram showing how the hidden variable summer produces a spurious correlation between ice-cream sales and drownings. summer (hidden variable) ice-cream sales drownings
Practice★☆☆Not started
State whether the following statement is true or false, giving reasons: 'The correlation coefficient between ice cream sales and the number of drownings in swimming…

State whether the following statement is true or false, giving reasons: 'The correlation coefficient between ice cream sales and the number of drownings in swimming pools is high and positive; therefore, selling more ice cream causes more drownings.' If it is false, explain the misinterpretation error and name a variable that could explain both at the same time.

Solve
Practice★★★Not started
In several districts of a European region, a correlation $r = 0,85$ has been observed between the number of storks recorded and the number of births registered. a)…

In several districts of a European region, a correlation $r = 0,85$ has been observed between the number of storks recorded and the number of births registered.

  1. a) Explain why it would be absurd to conclude that storks 'bring' babies, identifying the type of correlation shown in this example.
  1. b) Propose a plausible confounding variable that explains the correlation, and explain how it acts on both variables.
  1. c) Briefly outline what data you would collect and what calculation you would perform to unmask the spurious relationship.
Solve

Lab: comparing a line and a parabola with a spreadsheet

A sensor records the position of a trolley. These data are simulated for practice, with time $t$ in seconds and position $s$ in metres:

t 0 1 2 3 4
s 0,9 2,2 5,0 9,8 17,1

Before calculating, plot the points and make a prediction: does the position increase at a constant speed or does it seem to be accelerating?

  1. Type t in A1 and s in B1; put the five pairs in A2:B6. Create an XY scatter plot, not a chart that treats the times as category labels.

  2. Obtain a linear fit and a degree-2 polynomial fit using the fitting/trendline tool of your spreadsheet. Display the equations and keep enough decimal places. Check the coefficients against the calculation below.

  3. In C2 type =-1+4*A2 (linear prediction) and in D2 =1+A2^2 (quadratic); drag down to row 6. In E2 type =B2-C2 and in F2 =B2-D2: these are the residuals, observed minus predicted.

  4. In G2 type =E2^2, in H2 =F2^2 and in I2 =(B2-7)^2; drag down. Here 7 is the mean of the five positions. Add up each column; for example, =G2+G3+G4+G5+G6 avoids depending on the language of the functions.

The curvature can be seen by plotting the data together with both models:

Scatter plot of distance against time with the parabolic fit of a moving object's motion, illustrating interpolation and extrapolation. 04 s 016Position (m) lineparabola

The scatter plot and the residuals favour the parabola over this interval. At $t=2{,}5$, it predicts $7{,}25$ m; this is interpolation. At $t=10$, it predicts $101$ m, but this is a distant extrapolation: neither the fit nor its R² guarantees that the trolley will keep moving like that. Compare with a new measurement before using the model to make decisions.

Summary

See all the exercises in this section