Exercises: Non-linear regression and causality
In a linear least squares fit, a correlation coefficient $r = -0,9$ has been obtained. Calculate the coefficient of determination $r^2$ and interpret its meaning: what…
In a linear least squares fit, a correlation coefficient $r = -0,9$ has been obtained. Calculate the coefficient of determination $r^2$ and interpret its meaning: what percentage of the variation in the variable $y$ is explained by the variation in $x$?
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.
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 two statistical studies, the correlation coefficients $r_1 = 0,8$ and $r_2 = -0,95$ were obtained. Which of the two linear fits allows more reliable predictions to be…
In two statistical studies, the correlation coefficients $r_1 = 0,8$ and $r_2 = -0,95$ were obtained. Which of the two linear fits allows more reliable predictions to be made? Explain why the sign of the coefficient does not affect reliability.
An AEMET observatory in an inland peninsular capital records temperatures on a hot July day from 08:00 ($x = 0$) to 20:00 ($x = 12$). The thermometers read…
An AEMET observatory in an inland peninsular capital records temperatures on a hot July day from 08:00 ($x = 0$) to 20:00 ($x = 12$). The thermometers read $21\,^\circ\text{C}$ first thing in the morning, reach a maximum of $41\,^\circ\text{C}$ around 16:00 ($x = 8$), and drop to $33\,^\circ\text{C}$ at 20:00. A team of students is hesitating between three models to fit the data: the linear model $y = a + bx$, the exponential model $y = a \cdot b^x$ ($a > 0$, $b > 0$), and the quadratic model $y = ax^2 + bx + c$.
- a) Compare the graphical and growth properties of the three models and rule out two of them with reasoning, explaining why their behavior is physically incompatible with the evolution of temperature in that interval.
- b) For the model you have considered suitable, state with justification what sign parameter $a$ must have to reflect the existence of a daily maximum temperature.
- c) If when calculating the linear correlation coefficient a low value of $r = 0,38$ is obtained, a student states: "Since $r$ is so low, it is proven that the time of day barely influences temperature". Explain what conceptual error they are making when interpreting this value of $r$.
Lucía analyzes the market value depreciation of an electric vehicle in the Spanish used-car market as a function of its age $x$ (in years). To fit a decreasing…
Lucía analyzes the market value depreciation of an electric vehicle in the Spanish used-car market as a function of its age $x$ (in years). To fit a decreasing exponential model $y = a \cdot b^x$ ($y > 0$), she applies the natural logarithm transformation $z = \ln y$ and obtains the following line by least squares:
$$z = 10,2 - 0,15x$$In the conclusions of her final project, Lucía writes:
"The starting price of the new vehicle is $a = 10,2$ euros and with each passing year its value is multiplied by $b = -0,15$. Since the correlation coefficient of the transformed line is $r = -0,98$, the passage of time is the direct and sole cause of all the car's loss of value".
- a) Find the two algebraic errors Lucía makes when deducing parameters $a$ and $b$ from the linearized line and calculate their correct values (you may leave them expressed as powers of the number $e$ and give an approximation with two decimal places).
- b) Identify the conceptual error in her statement about causality and suggest at least one latent variable or variable unrelated to the car's age that also decisively influences its resale value.
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 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.
For the same data, two models have been tested: a linear fit with $r = 0,84$ and a quadratic fit with coefficient of determination $r^2 = 0,93$. a) Calculate the…
For the same data, two models have been tested: a linear fit with $r = 0,84$ and a quadratic fit with coefficient of determination $r^2 = 0,93$.
- a) Calculate the coefficient of determination of the linear model.
- b) What percentage of the variation in $y$ does each model explain?
- c) Which one would you choose to make predictions? Justify your answer.
In a city, a correlation $r = 0,92$ is observed between the number of fire engines that attend a fire and the financial damage it causes. A politician states: 'To reduce…
In a city, a correlation $r = 0,92$ is observed between the number of fire engines that attend a fire and the financial damage it causes. A politician states: 'To reduce fire damage, we should send fewer fire engines.' Analyse the fallacy in their reasoning, identify the variable that explains the correlation, and formulate a correct conclusion from the same data.
Using data from a bivariate distribution where $x$ varies between $10$ and $30$, with $\bar{x} = 20$ and $r = 0,97$, a regression line has been obtained. Two students…
Using data from a bivariate distribution where $x$ varies between $10$ and $30$, with $\bar{x} = 20$ and $r = 0,97$, a regression line has been obtained. Two students use it to estimate $y$: one for $x = 22$ and another for $x = 55$.
- a) Which estimate is more reliable? Give reasons for your answer using the position of each value relative to the range of the data and to $\bar{x}$.
- b) What is the name of the type of prediction made outside the range of the data, and why is it risky?
The diagram shows the percentage of Spanish households with a fibre-optic connection as a function of the years elapsed since 2015, according to INE data. a) Fit a…
The diagram shows the percentage of Spanish households with a fibre-optic connection as a function of the years elapsed since 2015, according to INE data.
- a) Fit a regression line to the first five data items using the means $\bar{x} = 4$, $\bar{y} = 64,6$ and the values $s_{xy} = 55,2$, $s_x^2 = 8$.
- b) Predict the percentage for $x = 12$ (year 2027) using this line.
- c) By observing the shape of the full scatter plot, criticise the validity of this long-term prediction: what natural bound does the variable have, and what type of model would be more sensible?
After calculating a correlation coefficient $r = 0,4$, a student writes in their report: 'Since $r = 0,4$, $40\,\%$ of the variation in $y$ is due to the variation in…
After calculating a correlation coefficient $r = 0,4$, a student writes in their report: 'Since $r = 0,4$, $40\,\%$ of the variation in $y$ is due to the variation in $x$.' Identify the conceptual error, correct it by calculating the correct percentage, and assess whether the linear fit is suitable for making predictions with this data.
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.
A team of biologists monitors the spread of an invasive plant species in a wetland in Doñana. The affected surface area $y$ (in $\text{m}^2$) is measured as a function…
A team of biologists monitors the spread of an invasive plant species in a wetland in Doñana. The affected surface area $y$ (in $\text{m}^2$) is measured as a function of the time elapsed $x$ (in weeks) since monitoring began, yielding the following measurements:
-
At $x = 0$ weeks: $y = 10\text{ m}^2$.
-
At $x = 2$ weeks: $y = 40\text{ m}^2$.
-
At $x = 4$ weeks: $y = 160\text{ m}^2$.
- a) Observe the pattern of variation in the data and make an intuitive estimate of what surface area the invasive plant will occupy at $x = 5$ weeks and at $x = 6$ weeks, explaining the reasoning you used.
- b) To mathematically verify your estimate, apply the logarithmic transformation $z = \ln y$ to the three data pairs. Prove that the transformed points $(x, z)$ are perfectly aligned along a line $z = \ln a + x \cdot \ln b$ and calculate the exact values of parameters $a$ and $b$ for the exponential model $y = a \cdot b^x$.
- c) Substitute $x = 5$ into the analytical model obtained, check whether it matches your previous estimate, and assess whether this exponential model remains plausible for predicting the occupied area after a full year ($x = 52$ weeks), taking into account the physical limits of the ecosystem.
The Directorate-General for Traffic (DGT) conducts road safety tests to model the total emergency braking distance $y$ (in meters) of a passenger car on wet pavement…
The Directorate-General for Traffic (DGT) conducts road safety tests to model the total emergency braking distance $y$ (in meters) of a passenger car on wet pavement according to the initial speed $x$ (measured in tens of km/h, that is, $x = 2$ represents $20\text{ km/h}$). The experimental results are as follows:
-
For $x = 2$: $y = 4\text{ m}$.
-
For $x = 4$: $y = 16\text{ m}$.
-
For $x = 8$: $y = 64\text{ m}$.
- a) The relationship is suspected to follow a power model $y = a \cdot x^b$. Apply the double natural logarithmic transformation ($w = \ln x$ and $z = \ln y$) and express the transformed coordinates $(w_i, z_i)$ in terms of $\ln 2$.
- b) Verify that the three transformed points belong to the same line $z = \ln a + b \cdot w$, algebraically calculate its slope $b$ and its $y$-intercept $\ln a$, and write the final equation of the power model $y = f(x)$.
- c) Interpret the numerical value of exponent $b$ drawing on physics (kinetic energy formula, $E_c = \frac{1}{2}m v^2$). Why does this model show that doubling the driving speed implies a much more drastic increase in impact risk?
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.
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.
In a bivariate distribution, the regression line of $y$ on $x$ has a gradient of $m_{yx} = 1,2$ and the regression line of $x$ on $y$ has a gradient of $m_{xy} = 0,75$.…
In a bivariate distribution, the regression line of $y$ on $x$ has a gradient of $m_{yx} = 1,2$ and the regression line of $x$ on $y$ has a gradient of $m_{xy} = 0,75$.
- a) Using the relationship $m_{yx} \cdot m_{xy} = r^2$, calculate the coefficient of determination.
- b) Deduce the value of the correlation coefficient $r$, justifying its sign.
- c) Interpret the value of $r^2$ as a percentage of explained variation and assess the reliability of predictions made using these lines.
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.
To model the trajectory of a projectile in a ballistic test, a sample of $N = 5$ points with abscissas symmetric with respect to the origin is taken: $x_1 = -2$,…
To model the trajectory of a projectile in a ballistic test, a sample of $N = 5$ points with abscissas symmetric with respect to the origin is taken: $x_1 = -2$, $x_2 = -1$, $x_3 = 0$, $x_4 = 1$, and $x_5 = 2$. We wish to fit a parabola by least squares $y = ax^2 + bx + c$, whose general system of normal equations is:
$$\begin{cases} a \sum x_i^4 + b \sum x_i^3 + c \sum x_i^2 = \sum x_i^2 y_i \\ a \sum x_i^3 + b \sum x_i^2 + c \sum x_i = \sum x_i y_i \\ a \sum x_i^2 + b \sum x_i + c \cdot N = \sum y_i \end{cases}$$- a) Calculate the sums $\sum x_i$, $\sum x_i^2$, $\sum x_i^3$, and $\sum x_i^4$. Explain what property of the symmetry of the $x_i$ causes parameter $b$ to become completely uncoupled from $a$ and $c$, simplifying the system of 3 equations into two independent blocks.
- b) Pose the inverse problem: the fitted curve is intended to have its vertex at $(0, 4)$ opening downward, resulting exactly in the model $y = -0,5x^2 + 4$. If the sum of the observed ordinates is $\sum y_i = 15$, deduce what exact value the weighted sum $\sum x_i^2 y_i$ must take for the model to satisfy the least-squares system.
- c) Construct a table with five specific values $(x_i, y_i)$ that simultaneously satisfy the symmetry $y_1 = y_5$, $y_2 = y_4$, $\sum y_i = 15$, and that fit this parabola. If you were to calculate the traditional linear correlation coefficient $r$ for these 5 points, what exact value would you obtain? Explain the apparent paradox between the value of $r$ and the strength of the existing functional dependence.
A study by the National Statistics Institute (INE) on socioeconomic development in municipalities of rural Spain analyzes the relationship between fiber optic coverage…
A study by the National Statistics Institute (INE) on socioeconomic development in municipalities of rural Spain analyzes the relationship between fiber optic coverage ($x$, in $\%$ of connected households) and average agricultural productivity ($y$, in thousands of euros per farm per year). To fit the data from 50 municipalities, an econometric team tests two logarithmic linearizations:
-
Option 1 (regression of $\ln y$ on $x$): obtains the line $z = 1,38 + 0,02 x$ with coefficient of determination $R_1^2 = 0,82$.
-
Option 2 (regression of $\ln y$ on $\ln x$): obtains the line $z = 0,69 + 0,55 w$ (where $w = \ln x$) with coefficient of determination $R_2^2 = 0,95$.
- a) Algebraically undo the transformations and write the explicit expression $y = f(x)$ that corresponds to each of the two models (you may round coefficients involving powers of $e$ to two decimal places).
- b) Analyze the behavior of the productivity growth rate in both models as the fiber coverage $x$ becomes very large. Justify which of the two better reflects the economic principle of diminishing returns (where each extra percentage point of coverage provides an increasingly smaller increase in productivity) and compare it with the statistical criterion provided by the $R^2$ coefficient.
- c) The mayor of a municipality concludes in a town hall meeting: "Since the power model has an excellent fit of $R^2 = 0,95$, investing the entire available budget in reaching $100\,\%$ fiber optics will directly guarantee that our farmers' productivity reaches the projected maximum". Provide a methodological critique of this conclusion by analyzing why correlation does not imply causation and pointing out at least two confounding (or lurking) variables that likely explain both high connectivity and high productivity simultaneously.