Two-Variable Descriptive Statistics
In Mérida, when the temperature goes up, the electric bill goes up too because of the fans and air conditioning. The price of a used cell phone drops as the months go by. When you measure two variables on the same individuals, you can study how they are related, summarize that relationship in a single number, and, if there is a trend, use it to make predictions. At the end of the page we will answer: can you confidently estimate the price of a cell phone from its age?
Two variables at once: functional and statistical dependence
When studying relationships between two variables, it is essential to distinguish whether there is an exact dependence or a statistical relationship. State in which of…
When studying relationships between two variables, it is essential to distinguish whether there is an exact dependence or a statistical relationship. State in which of the following cases the relationship is functional (an exact formula exists) and in which it is statistical (a trend exists, but with variability):
-
a) The number of liters of gas pumped at a gas station and the total cost to pay.
-
b) The grade obtained on a math exam and the number of hours the student spent studying that week.
-
c) The time an energy-saving light bulb remains turned on and the energy consumption recorded by the meter.
-
d) A person's height and their shoe size.
-
e) The maximum daily temperature in a city and the number of ice creams sold at a kiosk in that same city.
Scatter plot: sign and strength of the correlation
Each individual is a point $(x, y)$. The set of points is called a scatter plot. Its shape tells you two things:
-
Sign: if the cloud of points rises from left to right, the correlation is positive (as $X$ grows, $Y$ tends to grow). If it falls, it is negative. If no trend is visible, it is zero.
-
Strength: the closer the points are to a line, the stronger the correlation; the more scattered they are, the weaker.
A survey was conducted with 10 1st Baccalaureate students regarding the number of weekly hours they spend doing sport ($X$) and their resting heart rate ($Y$). The…
A survey was conducted with 10 1st Baccalaureate students regarding the number of weekly hours they spend doing sport ($X$) and their resting heart rate ($Y$). The results are represented in the following scatter plot:
Looking at the graph, answer the following questions:
-
a) Is the correlation between the variables positive or negative? Explain what this means in the context of the problem.
-
b) Do you think the correlation is strong or weak? Justify your answer based on how close the points are to a possible straight line.
Match each of the following values of Pearson's linear correlation coefficient, $r$, with the graph that best represents it: 1) $r = 0.95$ 2) $r = -0.85$ 3) $r = 0.05$
Match each of the following values of Pearson's linear correlation coefficient, $r$, with the graph that best represents it:
-
1) $r = 0.95$
-
2) $r = -0.85$
-
3) $r = 0.05$
A social media analyst has collected data on the number of short videos published by a group of content creators ($X$) and the number of new followers obtained in one…
A social media analyst has collected data on the number of short videos published by a group of content creators ($X$) and the number of new followers obtained in one week ($Y$). The resulting scatter plot is shown below:
From the graph:
-
State whether there is a correlation between both variables and, if so, determine its sign and approximate strength.
-
Is this a functional or statistical relationship? Justify your answer.
-
Estimate with reasons which of the following values could correspond to Pearson's linear correlation coefficient $r$: $-0.92$; $0.15$; $0.94$ or $1$.
Contingency table: joint and marginal frequencies
When the variables are categories (or have few values), it helps to organize the data in a two-way table.
A group of 20 teenagers has been classified according to their reading habit (Frequent reader / Non-reader) and their preference for book format (Paper / Digital). The…
A group of 20 teenagers has been classified according to their reading habit (Frequent reader / Non-reader) and their preference for book format (Paper / Digital). The data obtained are:
-
8 are frequent readers and prefer paper format.
-
4 are frequent readers and prefer digital format.
-
2 are non-readers but prefer paper format.
-
6 are non-readers and prefer digital format.
Organise this information into a joint frequency table (contingency table), including the marginal totals in the rows and columns.
From the following contingency table showing the main type of device used to study and the student's school year (4th Year ESO or 1st Baccalaureate), answer the…
From the following contingency table showing the main type of device used to study and the student's school year (4th Year ESO or 1st Baccalaureate), answer the questions asked:
| School year / Device | Tablet | Laptop | Mobile | Total |
|---|---|---|---|---|
| 4th Year ESO | 12 | 15 | 8 | 35 |
| 1st Baccalaureate | 10 | 25 | 5 | 40 |
| Total | 22 | 40 | 13 | 75 |
-
a) What is the joint absolute frequency of students who are in 1st Baccalaureate and mainly use a laptop?
-
b) Determine the marginal frequency of students who use a tablet.
-
c) How many students in total participated in the study?
-
d) What percentage of all students are from 4th Year ESO?
Conditional distributions and independence
Conditional mean and variance
When $Y$ is numerical, each row (or column) of the table is a data distribution and has its own mean and variance. These are the mean and variance of $Y$ conditional on $X=x_i$: they are computed as usual, but using only that row, with total $n_{i\bullet}$.
Given the following joint frequency table for variables $X$ (number of children) and $Y$ (number of rooms in the dwelling): | X \ Y | 1 | 2 | 3 | |-------|---|---|---| |…
Given the following joint frequency table for variables $X$ (number of children) and $Y$ (number of rooms in the dwelling):
| X \ Y | 1 | 2 | 3 |
|---|---|---|---|
| 0 | 5 | 2 | 0 |
| 1 | 1 | 6 | 3 |
| 2 | 0 | 2 | 6 |
- a) Calculate the marginal distributions of $X$ and $Y$.
- b) Determine the mean and variance of variable $Y$ conditioned on $X = 1$.
- c) Calculate the covariance $S_{xy}$ and state whether the variables are independent or show some type of association.
Center of gravity and covariance
For numerical data, the first summary is the point of the means.
Why does it work? Each point contributes the product $(x-\bar x)(y-\bar y)$. In the lower-left and upper-right quadrants that product is positive (two negative or two positive deviations); in the other two, negative. The covariance is the average of those products, and that is why its sign shows which way the cloud is heading.
Given the following pairs of variables, state whether you expect to find a positive, negative or zero correlation: a) The number of kilometers driven by a car and the…
Given the following pairs of variables, state whether you expect to find a positive, negative or zero correlation:
-
a) The number of kilometers driven by a car and the amount of fuel remaining in the tank.
-
b) The average grade in high school and the number of hours a student spends playing video games.
-
c) A person's age and their ID number.
-
d) A person's monthly income and the amount of money they save per month.
-
e) An athlete's average speed in a race and the time taken to complete it.
A courier company studies the relationship between package weight in kg ($X$) and shipping cost in pesos ($Y$). Five shipments have been analyzed with the following…
A courier company studies the relationship between package weight in kg ($X$) and shipping cost in pesos ($Y$). Five shipments have been analyzed with the following results:
| Weight $X$ (kg) | 1 | 2 | 3 | 5 | 9 |
|---|---|---|---|---|---|
| Cost $Y$ ( pesos) | 100 | 140 | 160 | 240 | 360 |
Calculate:
-
The center of gravity of the distribution $(\bar{x}, \bar{y})$.
-
The marginal standard deviations $\sigma_x$ and $\sigma_y$.
Pearson correlation coefficient
A study was conducted on the relationship between the daily time a 1st Baccalaureate student spends playing video games in hours ($X$) and their reaction time measured…
A study was conducted on the relationship between the daily time a 1st Baccalaureate student spends playing video games in hours ($X$) and their reaction time measured in milliseconds in a specific test ($Y$). The parameters obtained are:
$\bar{x} = 2.5$; $\bar{y} = 310$; $\sigma_x = 1.2$; $\sigma_y = 45$ and the covariance $\sigma_{xy} = -48.6$.
-
Calculate Pearson's linear correlation coefficient.
-
Interpret the result obtained in the context of the problem. What happens to reaction capacity as gaming hours increase?
A basketball club wants to predict the number of points scored by its players ($Y$) based on the minutes played ($X$). After analysing the players, the following data…
A basketball club wants to predict the number of points scored by its players ($Y$) based on the minutes played ($X$). After analysing the players, the following data are obtained:
$\sum x_i = 240$
$\sum y_i = 120$
$\sum x_i^2 = 6500$
$\sum y_i^2 = 1800$
$\sum x_i y_i = 3200$
Number of players analysed: $n = 10$.
-
Calculate Pearson's linear correlation coefficient.
-
If a player plays $25$ minutes, estimate the points they will score using the corresponding regression line.
It is investigated whether the price of a used cell phone model ($Y$, in pesos) depends on its age ($X$, in months). Data from 100 phones show that: $\bar{x} = 18$…
It is investigated whether the price of a used cell phone model ($Y$, in pesos) depends on its age ($X$, in months). Data from 100 phones show that:
$\bar{x} = 18$ months; $\bar{y} = 9\,000$ pesos; $\sigma_x = 6$; $\sigma_y = 1\,600$ and $r = -0.88$.
-
Calculate the covariance $\sigma_{xy}$.
-
Find the regression line of $Y$ on $X$.
-
What is the physical meaning of the slope of the line in this context?
-
Estimate the price of a phone that is a year and a half old. Is this estimation very reliable? Why?
Regression line of Y on X
If the correlation is strong, it makes sense to draw the line that best summarizes the scatter plot and use it to make predictions.
We have a bivariate variable $(X, Y)$ where $X$ represents the outdoor temperature in $^\circ\text{C}$ and $Y$ the electricity consumption of a shopping center in $kW$.…
We have a bivariate variable $(X, Y)$ where $X$ represents the outdoor temperature in $^\circ\text{C}$ and $Y$ the electricity consumption of a shopping center in $kW$. We know that the mean center of the distribution is the point $(\bar{x}, \bar{y}) = (22, 450)$.
If the regression line of $Y$ on $X$ has a slope of $b = 15$:
-
a) Write the equation of the regression line of $Y$ on $X$ using the point-slope form: $y - \bar{y} = b(x - \bar{x})$.
-
b) What would be the expected consumption for a temperature of $30^\circ\text{C}$?
The regression line relating the daily usage time of a social network in minutes ($X$) to the battery level consumed in percentage ($Y$) has been obtained. The equation…
The regression line relating the daily usage time of a social network in minutes ($X$) to the battery level consumed in percentage ($Y$) has been obtained. The equation of the line is:
$y = 0.15x + 2.5$
-
a) Estimate the percentage of battery consumed if a user uses the social network for $120$ minutes.
-
b) If the linear correlation coefficient is $r = 0.92$, do you think the previous estimation is reliable? Justify your answer.
The following table shows the marks obtained by 6 students in a Mathematics exam ($X$) and an Economics exam ($Y$): | Mathematics ($X$) | 4 | 6 | 5 | 8 | 9 | 7 | | :---…
The following table shows the marks obtained by 6 students in a Mathematics exam ($X$) and an Economics exam ($Y$):
| Mathematics ($X$) | 4 | 6 | 5 | 8 | 9 | 7 |
|---|---|---|---|---|---|---|
| Economics ($Y$) | 5 | 5 | 6 | 7 | 8 | 8 |
-
Find the covariance $\sigma_{xy}$.
-
Obtain the equation of the regression line of Economics ($Y$) on Mathematics ($X$).
-
What mark would be expected in Economics for a student who scored $10$ in Mathematics?
The two regression lines
There is also the line of $X$ on $Y$, which is used to predict $X$ from $Y$:
$$x-\bar x = \frac{\sigma_{xy}}{\sigma_y^2}\,(y-\bar y)$$The two lines cross at the center of gravity. If $r>0$ both rise; the line of $X$ on $Y$ looks steeper in the plane.
A streaming platform analyses the relationship between the average outdoor temperature in degrees Celsius ($X$) and the number of hours its users spend watching TV…
A streaming platform analyses the relationship between the average outdoor temperature in degrees Celsius ($X$) and the number of hours its users spend watching TV series over a weekend ($Y$). The regression line of $Y$ on $X$ obtained is:
$y = -0.45x + 18.2$
-
If on a weekend the average temperature is $8 ^\circ C$, how many hours is a user estimated to spend watching TV series?
-
If the coefficient of determination is $R^2 = 0.81$, how reliable is the previous prediction? Explain the meaning of this value.
The regression lines of a bivariate distribution are $4x - 5y + 12 = 0$ and $9x - 10y + 15 = 0$. a) Identify which of them is the regression line of $Y$ on $X$ and which…
The regression lines of a bivariate distribution are $4x - 5y + 12 = 0$ and $9x - 10y + 15 = 0$.
- a) Identify which of them is the regression line of $Y$ on $X$ and which is that of $X$ on $Y$. Justify your answer using the fact that the product of their gradients must equal $r^2$ and that $0 \leq r^2 \leq 1$.
- b) Calculate the linear correlation coefficient $r$.
- c) Determine the mean values $\bar{x}$ and $\bar{y}$.
A team of data analysts from a well-known microblogging network is studying the relationship between the number of words in a post ($X$) and the number of "likes"…
A team of data analysts from a well-known microblogging network is studying the relationship between the number of words in a post ($X$) and the number of "likes" received ($Y$). After analysing a random sample, the following parameters are known:
$\bar{x} = 45$ words
$\sigma_x = 12$
$S_{xy} = 156$
Regression line of $Y$ on $X$: $y = 1.083x + 11.25$
Knowing that the coefficient of determination is $R^2 = 0.64$, determine:
- a) The standard deviation of variable $Y$.
- b) The equation of the regression line of $X$ on $Y$.
- c) If a post has a number of "likes" that is double the mean $\bar{y}$, what would be the prediction for its number of words?
Predicting with care: interpolation and extrapolation
An estimate is reliable when two things hold:
-
$|r|$ is large (close to $1$): the line describes the scatter plot well.
-
You interpolate: the value of $x$ is within the range of the data used. If you extrapolate (outside the range), there is no guarantee that the trend will continue in the same way.
Let's go back to the beginning. With the data on age and price of cell phones, if $|r|$ is large and the age is within the observed range, you can estimate the price with the line of $Y$ on $X$ with good confidence. Outside that range, you can't.
In a study on healthy habits, the distance cycled per week in km ($X$) and bicycle maintenance expenditure in pesos ($Y$) are measured. It is known that the regression…
In a study on healthy habits, the distance cycled per week in km ($X$) and bicycle maintenance expenditure in pesos ($Y$) are measured. It is known that the regression line of $Y$ on $X$ is $y = 2.40x + 300$ and that the correlation coefficient is $r = 0.85$.
-
State whether the following statements are true or false, justifying your answer:
-
a) There is a functional dependence between km cycled and expenditure.
-
b) The relationship between the variables is direct.
-
c) If a cyclist cycles 0 km ($x=0$), the model estimates an expenditure of $300$ pesos.
-
-
If the average annual expenditure is $\bar{y} = 660$ pesos, what is the mean weekly km cycled $\bar{x}$?
A sociological study relates a household's digitalization index ($X$, scale 1-10) with annual savings ($Y$, in thousands of pesos). It is known that the regression line…
A sociological study relates a household's digitalization index ($X$, scale 1-10) with annual savings ($Y$, in thousands of pesos). It is known that the regression line of $Y$ on $X$ is $y = -24x + 300$ and that the coefficient of determination is $R^2 = 0.81$.
- a) If the variance of the digitalization indices is $\sigma_x^2 = 4$, what is the variance of the savings variable $\sigma_y^2$?
- b) If a household has a digitalization index of 8, estimate its annual savings and calculate the standard error of estimate (residual standard deviation), defined as $\sigma_{res} = \sigma_y \sqrt{1 - R^2}$.
In an e-sports competition, the players' age ($X$) and their reaction time to a visual stimulus ($Y$, in milliseconds) are measured. The scatter plot suggests an inverse…
In an e-sports competition, the players' age ($X$) and their reaction time to a visual stimulus ($Y$, in milliseconds) are measured. The scatter plot suggests an inverse linear relationship. The following simplified information is available:
$\sum x_i = 200$, $\sum y_i = 2500$, $\sum x_i^2 = 4150$, $\sum y_i^2 = 628000$, $\sum x_i y_i = 49400$ (for $n = 10$ players).
- a) Calculate the linear correlation coefficient.
- b) A 32-year-old player (outside the range of the original sample, which was 18 to 25 years) enters the study. If their reaction time were 280 ms, how would this new point affect the slope of the regression line of $Y$ on $X$? Justify your answer without needing to recalculate everything.
The relationship between a town's altitude ($X$, in meters) and atmospheric pressure ($Y$, in mb) is being investigated. Data from 5 towns show an almost perfect…
The relationship between a town's altitude ($X$, in meters) and atmospheric pressure ($Y$, in mb) is being investigated. Data from 5 towns show an almost perfect correlation ($r = -0.99$). The standard deviations are $\sigma_x = 400$ and $\sigma_y = 45$.
If the mean pressure is $950$ mb at a mean altitude of $600$ meters:
- a) Find the equation of the regression line to predict pressure as a function of altitude.
- b) At what altitude would a pressure of $1013$ mb be expected? Evaluate the reliability of this answer, considering whether it is an interpolation or extrapolation.
- c) If it were discovered that the altimeters had a systematic error and all real altitudes are $50$ meters higher than recorded, how would this affect the slope of the regression line?
What happens when you change the scale or shift the data
What happens to $\sigma_{xy}$ and $r$ if you convert $X$ to other units or add a constant to all the data? If $x'=ax+b$ and $y'=cy+d$:
The relationship between weekly study time ($X$, in hours) and the average mark ($Y$) of a group of students is analysed. It is known that the covariance is…
The relationship between weekly study time ($X$, in hours) and the average mark ($Y$) of a group of students is analysed. It is known that the covariance is $S_{xy} = 4.5$ and the correlation coefficient is $r = 0.75$. If all students are rewarded with 1 extra mark on their average mark and, in addition, decide to study twice as many hours the following week:
- a) Prove mathematically how the new covariance $S'_{xy}$ and the new correlation coefficient $r'$ vary.
- b) Would the reliability of the linear model's predictions change after these changes? Justify your answer based on the properties of bivariate parameters.