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.
When a straight line is not the right model
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.
Linearising an exponential model with 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,…
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$ |
- a) Verify that the four linearised points lie exactly on a straight line and find its equation.
- b) Deduce the values of $a$ and $b$ (express $a$ and $b$ as powers of $e$ and approximate them to two decimal places).
- c) Estimate the number of users after $6$ months.
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$ |
- 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).
- b) Write down the corresponding exponential model $y = a \cdot b^x$ and calculate the monthly growth rate as a percentage.
- 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.
Linearising a power model
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$ |
- a) Fit a straight line to the linearised data and write down its equation.
- b) Deduce the values of $a$ and $b$.
- c) Compare the value obtained for $b$ with that predicted by Physics, $b = \frac{1}{2}$, and comment on the result.
Quadratic fit by least squares
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.
- a) Set up the system of three equations that the coefficients of the regression parabola $y = a x^2 + bx + c$ must satisfy.
- b) Solve it and write down the equation of the quadratic fit.
- c) Estimate the value of $y$ for $x = 5$ and comment on the reliability of this prediction.
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$ |
- a) Mentally represent (or sketch) the scatter plot and explain why a quadratic model is more suitable than a linear one.
- 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.
- c) Solve the system and write down the equation of the regression parabola (round the coefficients to four decimal places).
- 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.
You can do it on paper and send a photo with your answer.
Correlation is not causation
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.
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.
- a) Explain why it would be absurd to conclude that storks 'bring' babies, identifying the type of correlation shown in this example.
- b) Propose a plausible confounding variable that explains the correlation, and explain how it acts on both variables.
- c) Briefly outline what data you would collect and what calculation you would perform to unmask the spurious relationship.
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?
-
Type
tin A1 andsin B1; put the five pairs in A2:B6. Create an XY scatter plot, not a chart that treats the times as category labels. -
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.
-
In C2 type
=-1+4*A2(linear prediction) and in D2=1+A2^2(quadratic); drag down to row 6. In E2 type=B2-C2and in F2=B2-D2: these are the residuals, observed minus predicted. -
In G2 type
=E2^2, in H2=F2^2and 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+G6avoids depending on the language of the functions.
The curvature can be seen by plotting the data together with both models:
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.