Back to homeMathematics · High School Year 2 · Physics-Math · Change subject
Start for free
Prep 2 Tech · Mathematics
Bivariate distributions · Bivariate statistics

Two-Variable Distributions

Before you start, make sure you know: Mean and variance (High School Year 1 (semesters 1 and 2))
Before you start, make sure you know: Two-variable distributions (High School Year 1 (semesters 1 and 2))

The area of a circle depends on its radius through an exact formula. But the hours you study for a test and your grade are also related, even though there is no formula: there is a trend, and there is also scatter. Can we measure how strong that relationship is and use it to make predictions? That is what we do when we study two variables at once on the same individuals.

Functional and statistical dependence

Comparison between a functional relationship with an exact curve and a statistical relationship with a linear trend and scattered points functional: exact formula statistical: trend + scatter

The graph of the points $(x_i, y_i)$ is called a scatter plot (or point cloud). Depending on its shape, we talk about correlation:

  • Positive: the cloud rises from left to right (if one variable increases, so does the other).

  • Negative: the cloud falls (if one increases, the other decreases).

  • None: there is no linear pattern.

Practice★☆☆Not started
Classify the following pairs of bivariate statistical variables according to the type of linear correlation (positive, negative or zero) expected between them: The…

Classify the following pairs of bivariate statistical variables according to the type of linear correlation (positive, negative or zero) expected between them:

  • The weight of a vehicle and its fuel consumption per 100 km.

  • The number of hours of direct sunlight and the amount of energy produced by a solar panel.

  • An adult's shoe size and their monthly salary.

  • The continuous usage time of a laptop and the remaining battery percentage.

Solve
Practice★☆☆Not started
Look at the following scatter diagrams relating different variables in three different experiments. Giving reasons, match each graph to one of the following linear…

Look at the following scatter diagrams relating different variables in three different experiments. Giving reasons, match each graph to one of the following linear correlation coefficients: $r = -0.92$, $r = 0.05$, $r = 0.88$.

A B C
Solve

Frequency tables, marginal and conditional distributions

When there is a lot of data, it is arranged in a two-way table: each cell $f_{ij}$ counts how many individuals have both the value $x_i$ and the value $y_j$. The total is $N$.

Example: at a high school, the shift ($Y$: 1 morning, 2 afternoon) and the number of failed classes ($X$) were recorded for 40 students.

$Y \backslash X$ 0 1 2 Total
1 10 6 4 20
2 6 8 6 20
Total 16 14 10 40

If the variables come in class intervals, the class mark (the midpoint of each interval) is used as the value of the variable and the calculation is done the same way.

Practice★☆☆Not started
In an electronics factory, the number of defects found in a batch ($X$) and the production shift ($Y$, where 1 is morning, 2 is afternoon and 3 is night) were measured…

In an electronics factory, the number of defects found in a batch ($X$) and the production shift ($Y$, where 1 is morning, 2 is afternoon and 3 is night) were measured over 50 days. The joint frequency table is as follows:

$Y \backslash X$ 0 1 2 3
1 5 8 2 0
2 4 10 5 1
3 1 4 8 2

Calculate the marginal distribution of the variable $X$ (number of defects) and determine its arithmetic mean.

Solve
Practice★☆☆Not started
In an electronics factory, the number of defects found in a batch ($X$) and the production shift ($Y$, where 1 is morning, 2 is afternoon and 3 is night) were measured…

In an electronics factory, the number of defects found in a batch ($X$) and the production shift ($Y$, where 1 is morning, 2 is afternoon and 3 is night) were measured over 50 days. The joint frequency table is as follows:

$Y \backslash X$ 0 1 2 3
1 5 8 2 0
2 4 10 5 1
3 1 4 8 2

Obtain the distribution of the variable $X$ conditional on production having taken place exclusively during the night shift ($Y=3$).

Solve
Practice★★☆Not started
In a clinical trial, 100 patients were classified according to their age group ($X$, in years) and their blood cholesterol level ($Y$, in mg/dL), grouped into class…

In a clinical trial, 100 patients were classified according to their age group ($X$, in years) and their blood cholesterol level ($Y$, in mg/dL), grouped into class intervals.

$X \backslash Y$ $[150, 180)$ $[180, 210)$ $[210, 240)$
$[30, 40)$ 15 10 5
$[40, 50)$ 5 20 15
$[50, 60)$ 2 8 20

Calculate the mean and standard deviation of the cholesterol level exclusively for patients in the age group $[40, 50)$. Use class midpoints for your calculations.

Solve
Practice★★☆Not started
In a survey of 200 university students, the relationship between the number of weekly hours spent playing sports ($X$) and the reported stress level ($Y$, measured from…

In a survey of 200 university students, the relationship between the number of weekly hours spent playing sports ($X$) and the reported stress level ($Y$, measured from 1 to 3) was studied. Some data from the contingency table have been erased:

$X \backslash Y$ 1 2 3 Total
1 20 15 5 40
2 10 $a$ 20 $b$
3 5 25 40 70
Total 35 $c$ 65 200

Complete the table knowing that $30\%$ of the total respondents spend 2 hours playing sports and have a stress level of 2. Once completed, mathematically justify whether the variables are statistically independent.

Solve
Practice★★★Not started
In a study, the variables $X$ and $Y$ take the values $X \in \{2, 4, 6\}$ and $Y \in \{4, 6, 8\}$. The marginal distributions are identical and uniform (absolute…

In a study, the variables $X$ and $Y$ take the values $X \in \{2, 4, 6\}$ and $Y \in \{4, 6, 8\}$. The marginal distributions are identical and uniform (absolute frequency of 10 for each individual value, with a sample size of $N=30$). Furthermore, it is known that the joint distribution is perfectly symmetric ($f_{ij} = f_{ji}$) and that the joint frequency for $X=2$ and $Y=4$ is 8, for $X=2$ and $Y=6$ is 2, and for $X=4$ and $Y=6$ is 2.

Calculate the remaining joint frequencies in the table and prove that the covariance of this distribution is $\sigma_{xy} = 1.6$.

Solve

Center of gravity and covariance

Why does it work? The covariance is the average of $(x_i-\bar x)(y_i-\bar y)$. A point to the upper right or lower left of the center contributes a positive product; one in the other two quadrants contributes a negative one.

Scatter plot with the center of gravity and the lines of the means dividing the plane into four quadrants for calculating the covariance mean of x mean of y points lower-left and upper-right of the center: positive covariance

For the calculations you also need the marginal variances: $\sigma_x^2 = \dfrac{\sum x_i^2 f_i}{N}-\bar x^2$ and $\sigma_y^2$ the same with $y$; the standard deviation is their square root.

Practice★☆☆Not started
In a study on the performance of 12 servers, the amount of allocated RAM in GB ($X$) and the number of requests processed per second ($Y$) were recorded. Given that…

In a study on the performance of 12 servers, the amount of allocated RAM in GB ($X$) and the number of requests processed per second ($Y$) were recorded. Given that $\sum_{i=1}^{12} x_i y_i = 4500$, the mean RAM is $\bar{x} = 16$ GB and the mean number of requests is $\bar{y} = 22$, calculate the covariance $\sigma_{xy}$.

Solve
Practice★★☆Not started
In an agricultural cooperative, the amount of fertiliser applied in kg/ha ($X$) and the crop yield in metric tons/ha ($Y$) were recorded across 5 experimental plots:…

In an agricultural cooperative, the amount of fertiliser applied in kg/ha ($X$) and the crop yield in metric tons/ha ($Y$) were recorded across 5 experimental plots:

  • $X$: 10, 20, 30, 40, 50

  • $Y$: 2.5, 3.8, 4.2, 5.5, 6.0

Calculate the marginal means, marginal variances and covariance of this bivariate distribution.

Solve
Practice★★★Not started
The relationship between the drying time of an industrial paint ($X$, in hours) and its abrasion resistance ($Y$, on an index from 0 to 100) was analysed in 4 trials,…

The relationship between the drying time of an industrial paint ($X$, in hours) and its abrasion resistance ($Y$, on an index from 0 to 100) was analysed in 4 trials, yielding the following pairs of values: $(2, 40)$, $(3, 55)$, $(5, k)$, $(6, 85)$.

If it is known that the marginal mean of the resistance is $\bar{y} = 62.5$, first determine the value of the parameter $k$. Next, calculate the covariance $\sigma_{xy}$ and the gradient of the regression line of $Y$ on $X$.

Solve

Covariance under linear transformations

Sometimes you change units (from kg to grams, from °C to °F). How does the covariance change without redoing the whole calculation?

Something similar happens with the standard deviations: $\sigma_u = |a|\sigma_x$ and $\sigma_v = |c|\sigma_y$. That is why, in the correlation coefficient (next section), the factor $|ac|$ cancels out and only the sign remains.

Practice★★☆Not started
Let $(X, Y)$ be a two-dimensional distribution with covariance $\sigma_{xy} = 15$ and correlation coefficient $r = 0.6$. If a linear transformation is performed on the…

Let $(X, Y)$ be a two-dimensional distribution with covariance $\sigma_{xy} = 15$ and correlation coefficient $r = 0.6$. If a linear transformation is performed on the variables to adapt them to a new measurement scale, such that $U = 2X - 3$ and $V = -0.5Y + 1$, calculate the new covariance $\sigma_{uv}$ and the new correlation coefficient $r_{uv}$ between $U$ and $V$.

Solve

Linear correlation coefficient

To measure the strength of the relationship regardless of units, the covariance is divided by the standard deviations.

In the previous example, $r=\dfrac{1.75}{\sqrt{1.25}\sqrt{2.5}}\approx 0.99$: a very strong direct linear relationship.

If there is an exact linear relationship $Y=aX+b$, then $\sigma_{xy}=a\,\sigma_x^2$ and $\sigma_y=|a|\sigma_x$ (by the properties of the mean and variance under linear transformations). Thus $r=\dfrac{a\,\sigma_x^2}{|a|\,\sigma_x^2}=\dfrac{a}{|a|}$, which equals $1$ if $a>0$ and $-1$ if $a<0$.

Practice★☆☆Not started
The covariance between the daily mean temperature in degrees Celsius ($X$) and ice cream sales in hundreds of pesos ($Y$) at an ice cream parlor during summer is…

The covariance between the daily mean temperature in degrees Celsius ($X$) and ice cream sales in hundreds of pesos ($Y$) at an ice cream parlor during summer is $\sigma_{xy} = 18.5$. If the marginal standard deviations are $\sigma_x = 4.2$ and $\sigma_y = 5.1$, calculate the linear correlation coefficient $r$ and interpret the result.

Solve
Practice★★★Not started
The following scatter diagram relates the concentration of a chemical pollutant in a river ($X$, in ppm) to the mortality rate of a fish species ($Y$, in %). Observe the…

The following scatter diagram relates the concentration of a chemical pollutant in a river ($X$, in ppm) to the mortality rate of a fish species ($Y$, in %). Observe the presence of an outlier clearly distinct from the rest of the scatter plot.

Explain, giving reasons, how removing this outlier would affect the covariance $\sigma_{xy}$, the gradient of the regression line of $Y$ on $X$, and the linear correlation coefficient $r$.

X (ppm) Y (%) Outlier
Solve
Practice★★★Not started
Consider a bivariate distribution of variables $(X, Y)$ with strictly positive marginal standard deviations ($\sigma_x > 0$ and $\sigma_y > 0$). Prove analytically that…

Consider a bivariate distribution of variables $(X, Y)$ with strictly positive marginal standard deviations ($\sigma_x > 0$ and $\sigma_y > 0$). Prove analytically that if an exact linear functional relationship exists between both variables of the form $Y = aX + b$ (with $a \neq 0$), then the linear correlation coefficient is $r = 1$ if $a > 0$, or $r = -1$ if $a < 0$. (Hint: use the properties of the mean and variance under linear transformations).

Solve

Regression lines

If there is correlation, we can summarize the cloud with a line and use it to make predictions. There are two, depending on which variable we want to estimate.

Why two lines? The line of $Y$ on $X$ minimizes the vertical errors; the line of $X$ on $Y$, the horizontal ones. They coincide only if $r=\pm 1$.

Derivation of $m\,m'=r^2$. Writing the lines as $y=mx+n$ and $x=m'y+n'$, the slopes are $m=\dfrac{\sigma_{xy}}{\sigma_x^2}$ and $m'=\dfrac{\sigma_{xy}}{\sigma_y^2}$. Multiplying:

$$m\,m'=\frac{\sigma_{xy}^2}{\sigma_x^2\,\sigma_y^2}=\left(\frac{\sigma_{xy}}{\sigma_x\sigma_y}\right)^2=r^2$$

Therefore $r=\pm\sqrt{m\,m'}$. Since $\sigma_x^2$ and $\sigma_y^2$ are positive, $m$ and $m'$ always have the sign of $\sigma_{xy}$, and that is also the sign of $r$: if the slopes are positive, $r>0$; if they are negative, $r<0$.

Practice★☆☆Not started
In an analysis of the relationship between monthly digital marketing spend ($X$, in thousands of pesos) and sales revenue ($Y$, in thousands of pesos), the two…

In an analysis of the relationship between monthly digital marketing spend ($X$, in thousands of pesos) and sales revenue ($Y$, in thousands of pesos), the two regression lines have been obtained. The regression line of $Y$ on $X$ is $y = 2.5x + 200$ and the regression line of $X$ on $Y$ is $x = 0.36y - 40$. Determine the mean point (center of gravity) $(\bar{x}, \bar{y})$ of this bivariate distribution.

Solve
Practice★★☆Not started
The analysis of macroeconomic data from 20 countries shows that the mean Gross Domestic Product per capita ($X$, in thousands of pesos) is $\bar{x} = 500$, with a…

The analysis of macroeconomic data from 20 countries shows that the mean Gross Domestic Product per capita ($X$, in thousands of pesos) is $\bar{x} = 500$, with a standard deviation of $\sigma_x = 160$. The mean energy consumption per capita ($Y$, in MWh) is $\bar{y} = 12$, with a standard deviation of $\sigma_y = 4$. If the linear correlation coefficient is $r = 0.85$, determine the equation of the regression line of $Y$ on $X$.

Solve
Practice★★☆Not started
In a study on the relationship between annual rainfall ($X$, in mm) and wheat yield ($Y$, in metric tons per hectare), it is known that the regression line of $Y$ on $X$…

In a study on the relationship between annual rainfall ($X$, in mm) and wheat yield ($Y$, in metric tons per hectare), it is known that the regression line of $Y$ on $X$ is $y = 0.15x - 12$. If the mean rainfall is $\bar{x} = 400$ mm and the correlation coefficient is $r = 0.75$, find the equation of the regression line of $X$ on $Y$.

Solve
Practice★★★Not started
In a sociodemographic analysis, the two regression lines relating the birth rate ($X$, per thousand) and life expectancy ($Y$, in years) of a region have been obtained.…

In a sociodemographic analysis, the two regression lines relating the birth rate ($X$, per thousand) and life expectancy ($Y$, in years) of a region have been obtained. The equations of the lines are:

$3x + y - 105 = 0$

$x + 2y - 160 = 0$

Identify, giving reasons, which is the regression line of $Y$ on $X$ and which is that of $X$ on $Y$. Subsequently, calculate the marginal means $\bar{x}$ and $\bar{y}$, and the linear correlation coefficient $r$.

Solve
Practice★★★Not started
Prove mathematically that if the equations of the regression lines of $Y$ on $X$ and $X$ on $Y$ are expressed in the form $y = mx + n$ and $x = m'y + n'$ respectively,…

Prove mathematically that if the equations of the regression lines of $Y$ on $X$ and $X$ on $Y$ are expressed in the form $y = mx + n$ and $x = m'y + n'$ respectively, then the linear correlation coefficient satisfies $r = \pm \sqrt{m \times m'}$. Furthermore, give reasons as to what determines the sign of $r$.

Solve

Prediction, goodness of fit, and nonlinear models

For example, if $r=0.8$ and $\sigma_y^2=25$, then $R^2=0.64$ (the line explains $64\%$ of the variation) and $\sigma_e^2=25(1-0.64)=9$.

Interpolating and extrapolating

A prediction is reliable when $|r|$ is high and $x$ is within the range of the data (interpolation). Outside the range (extrapolation) there is no guarantee that the trend will continue.

When the relationship is not linear

If the data follow $Y=A\,e^{BX}$, we take the natural logarithm: $Z=\ln Y=\ln A+BX$ is linear in $X$. We do the regression of $Z$ on $X$: $B=\dfrac{\sigma_{xz}}{\sigma_x^2}$ and $\ln A=\bar z-B\,\bar x$, from which $A=e^{\ln A}$.

Practice★☆☆Not started
The human resources department of a software company has determined that the regression line relating years of experience ($X$) to monthly salary in pesos ($Y$) of its…

The human resources department of a software company has determined that the regression line relating years of experience ($X$) to monthly salary in pesos ($Y$) of its programmers is $y = 1\,700x + 24\,000$. Estimate the monthly salary of an employee who has 5 years of experience.

Solve
Practice★★☆Not started
The following scatter diagram shows the relationship between the temperature applied to a metal alloy ($X$, in $^\circ\text{C}$) and its thermal expansion ($Y$, in mm).…

The following scatter diagram shows the relationship between the temperature applied to a metal alloy ($X$, in $^\circ\text{C}$) and its thermal expansion ($Y$, in mm). From the visual representation of the scatter plot and the fitted regression line, estimate the value of the y-intercept and the gradient of the line. Subsequently, predict the expansion for a temperature of $80^\circ\text{C}$.

20 40 60 80 2 4 6 8 T (°C) Exp. (mm)
Solve
Practice★★☆Not started
An e-commerce platform has modelled the relationship between the number of daily visits to a product page ($X$) and the number of units sold ($Y$) using the regression…

An e-commerce platform has modelled the relationship between the number of daily visits to a product page ($X$) and the number of units sold ($Y$) using the regression line $y = 0.04x + 2.5$. The correlation coefficient is $r = 0.91$ and the range of visits in the studied sample is between 100 and 500.

  1. a) Estimate the sales if a product receives 350 visits.
  2. b) Estimate the sales if a product receives 2000 visits.
  3. c) Discuss the reliability of both predictions based on the data provided.
Solve
Practice★★★Not started
The growth of a bacterial colony as a function of time ($X$, in hours) does not follow a linear model, but an exponential one of the form $Y = A \times e^{BX}$, where…

The growth of a bacterial colony as a function of time ($X$, in hours) does not follow a linear model, but an exponential one of the form $Y = A \times e^{BX}$, where $Y$ is the number of bacteria (in thousands). To apply linear regression techniques, the change of variable $Z = \ln Y$ is performed.

The transformed data $(X, Z)$ yield the following marginal and joint results for 5 observations: $\bar{x} = 4$, $\bar{z} = 2.1$, $\sigma_x^2 = 2.5$, $\sigma_{xz} = 1.2$.

Calculate the values of the parameters $A$ and $B$ of the original exponential model.

Solve
Practice★★★Not started
For a bivariate statistical distribution $(X, Y)$ of sample size $N = 10$, the following sums are known: $\sum x_i = 50$, $\sum y_i = 70$, $\sum x_i^2 = 286$,…

For a bivariate statistical distribution $(X, Y)$ of sample size $N = 10$, the following sums are known:

$\sum x_i = 50$, $\sum y_i = 70$, $\sum x_i^2 = 286$, $\sum y_i^2 = 540$, $\sum x_i y_i = 385$.

Calculate the coefficient of determination $R^2$ and the residual variance $\sigma_e^2$. Interpret the meaning of both values in the context of the goodness of fit of the linear model.

Solve

Go back to the beginning: study hours and grades have a statistical dependence; their covariance and their coefficient $r$ measure the trend, and the regression line lets us predict within the observed range.

Summary

See all the exercises in this section