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

Basic Statistics

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: Measures of position (High School Year 1 (semesters 1 and 2))

Ximena studied 10 hours for the exam and got a 9. Diego studied 2 hours and got a 6. With only two students you can't conclude anything, but with the whole class you can: does studying more raise your grade, and how strong is that relationship? To answer, you need to measure two variables at once. First, you have to master the one-variable tools rigorously, because they are the building blocks of everything that comes after.

Mean, variance, and standard deviation

The mean minimizes the squared error

For any constant $c$, adding and subtracting $\bar x$ inside the square gives:

$$\sum (x_i-c)^2=\sum (x_i-\bar x)^2+n(\bar x-c)^2$$

The cross term vanishes because $\sum(x_i-\bar x)=0$. The second summand is never negative and equals zero only when $c=\bar x$. That is why $f(c)=\sum (x_i-c)^2$ reaches its minimum at $c=\bar x$.

With derivatives you arrive at the same result: $f'(c)=-2\sum(x_i-c)=0$ gives $c=\bar x$, and $f''(c)=2n>0$ confirms it is a minimum. Later on, the regression line is also defined by "minimizing squared errors."

Practice★☆☆Not started
An agricultural engineer is calibrating a soil moisture sensor. The last 5 readings, as percentages, are: $22, 24, 23, 25, 21$. Calculate the arithmetic mean and the…

An agricultural engineer is calibrating a soil moisture sensor. The last 5 readings, as percentages, are: $22, 24, 23, 25, 21$. Calculate the arithmetic mean and the population standard deviation of these measurements.

Solve
Practice★★☆Not started
A cycling team recorded the distances covered in their last 4 training sessions: $45, 50, x, 60$ kilometers. Given that the mean distance of the 4 training sessions is…

A cycling team recorded the distances covered in their last 4 training sessions: $45, 50, x, 60$ kilometers. Given that the mean distance of the 4 training sessions is exactly $52.5$ km, first determine the missing training session value ($x$) and then calculate the population standard deviation of the 4 training sessions.

Solve
Practice★★★Not started
Given a univariate dataset $x_1, x_2, \dots, x_n$, the squared error function $f(c) = \sum_{i=1}^n (x_i - c)^2$ is defined, measuring the sum of squared distances from…

Given a univariate dataset $x_1, x_2, \dots, x_n$, the squared error function $f(c) = \sum_{i=1}^n (x_i - c)^2$ is defined, measuring the sum of squared distances from each data point to a constant value $c$. Prove analytically (using derivatives or completing the square) that the value of $c$ that minimises this function is exactly the arithmetic mean $\bar{x}$.

Solve

Combining samples and correcting data

Sometimes you don't have the individual data, only means and variances. From the variance formula, the mean of the squares is $\sigma^2+\bar x^2$. With that quantity you can reconstruct almost everything.

Practice★★★Not started
A quality control analyst observes manufacturing errors in 10 production batches. The mean number of errors is $6.5$ and the variance is $2.25$. Later, during an audit,…

A quality control analyst observes manufacturing errors in 10 production batches. The mean number of errors is $6.5$ and the variance is $2.25$. Later, during an audit, they notice that a typographical error recorded $2$ errors instead of $8$ for one of the batches. Calculate the corrected new mean and variance without needing to know the individual data for the other 9 batches.

Solve
Practice★★★Not started
Two independent epidemiological studies on body mass index (BMI) were carried out in a region. The first study, with a sample of $40$ people, obtained a mean of $22$ and…

Two independent epidemiological studies on body mass index (BMI) were carried out in a region. The first study, with a sample of $40$ people, obtained a mean of $22$ and a variance of $4$. The second study, with a sample of $60$ people, obtained a mean of $25$ and a variance of $5$. If both studies are combined into a single pooled sample of $100$ people, calculate the mean and variance of this combined sample.

Solve

Coefficient of variation

Is a $150$ cm fish with $\sigma=12$ cm more "irregular" than a $40$ cm fish with $\sigma=4$ cm? The standard deviation alone is no good for comparing, because it depends on the units and on the size of the data.

Practice★☆☆Not started
A marine biologist compares the length of two fish species. Species Alpha has a mean length of $40$ cm with a standard deviation of $4$ cm. Species Beta has a mean…

A marine biologist compares the length of two fish species. Species Alpha has a mean length of $40$ cm with a standard deviation of $4$ cm. Species Beta has a mean length of $150$ cm with a standard deviation of $12$ cm. Calculate the coefficient of variation for both species and state which one shows greater relative dispersion.

Solve
Practice★★☆Not started
Two aeronautical component factories produce parts whose lifespan is a statistical variable. Factory Alpha produces components with a mean lifespan of $1200$ hours and a…

Two aeronautical component factories produce parts whose lifespan is a statistical variable. Factory Alpha produces components with a mean lifespan of $1200$ hours and a variance of $14400$ hours$^2$. Factory Beta produces components with a mean lifespan of $800$ hours and a variance of $10000$ hours$^2$. By calculating a suitable measure of relative dispersion, justify which factory has a more homogeneous production.

Solve

Position and grouped data

Quartiles divide the ordered data into four equal parts. $Q_1$ leaves $25\%$ below it, the median $50\%$, and $Q_3$ $75\%$. The mode is the value with the highest frequency.

Box-and-whisker plot showing the minimum, maximum, median, and quartiles dividing the distribution into four 25% sections. Q₁medianQ₃ 25 %25 %25 %25 % minmax

If $n$ is odd, the median is not included in either half when calculating $Q_1$ and $Q_3$.

Data grouped in intervals

When the data come in intervals $[a,b)$, each interval is represented by its class mark $\frac{a+b}{2}$. The midpoint is used because, since the exact data are unknown, the errors from overestimating and underestimating tend to cancel out.

Practice★☆☆Not started
The scores obtained by the 9 members of a rhythmic gymnastics team in a flexibility test are: $16, 17, 16, 18, 16, 17, 19, 16, 17$. Determine the mode, the median and…

The scores obtained by the 9 members of a rhythmic gymnastics team in a flexibility test are: $16, 17, 16, 18, 16, 17, 19, 16, 17$. Determine the mode, the median and the lower quartile ($Q_1$) of this dataset.

Solve
Practice★★☆Not started
At a weather station, the maximum daily wind speed ($X$, in km/h) has been grouped into the following intervals: $[0, 10)$, $[10, 20)$, $[20, 30)$, $[30, 40)$, with…

At a weather station, the maximum daily wind speed ($X$, in km/h) has been grouped into the following intervals: $[0, 10)$, $[10, 20)$, $[20, 30)$, $[30, 40)$, with absolute frequencies $5, 12, 8, 5$ respectively. Using the class midpoints of each interval, calculate the arithmetic mean and variance of the wind speed.

Solve

Two-way tables

When you measure $X$ and $Y$ on the same individuals, each individual gives a pair $(x_i,y_j)$. The two-way table puts the values of $X$ in the rows, the values of $Y$ in the columns, and in each cell the joint frequency $n_{ij}$: how many times that pair appears.

Practice★☆☆Not started
In a maternity ward, the weight in kg ($X$) and length in cm ($Y$) of 6 newborn babies were measured, obtaining the following pairs of values $(x_i, y_i)$: $(3.2; 50)$,…

In a maternity ward, the weight in kg ($X$) and length in cm ($Y$) of 6 newborn babies were measured, obtaining the following pairs of values $(x_i, y_i)$: $(3.2; 50)$, $(3.5; 52)$, $(3.2; 51)$, $(3.8; 52)$, $(3.5; 50)$ and $(3.2; 50)$. Construct the two-way table (joint absolute frequencies) for these two variables.

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

Solve
Practice★☆☆Not started
In a sociological study on reading habits, 50 people were surveyed about their sex ($X$: $1$ for Male, $2$ for Female) and whether they read more than one book a month…

In a sociological study on reading habits, 50 people were surveyed about their sex ($X$: $1$ for Male, $2$ for Female) and whether they read more than one book a month ($Y$: $1$ for Yes, $2$ for No). The joint absolute frequency table $n_{ij}$ is as follows: $n_{11} = 10$, $n_{12} = 15$, $n_{21} = 20$, $n_{22} = 5$. Construct the marginal distribution table for the variable $Y$ and calculate its relative frequencies.

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

Solve

Marginal and conditional distributions

Practice★☆☆Not started
From a joint frequency table of two variables $X$ (number of siblings) and $Y$ (number of pets), it is known that the marginal absolute frequency of $X=1$ is…

From a joint frequency table of two variables $X$ (number of siblings) and $Y$ (number of pets), it is known that the marginal absolute frequency of $X=1$ is $n_{1\bullet} = 40$. Of those 40 people, 15 have $Y=0$ pets, 20 have $Y=1$ pet and 5 have $Y=2$ pets. Calculate the relative frequency distribution of the variable $Y$ conditional on $X=1$.

Solve
Practice★★☆Not started
A veterinary clinic classifies the dogs seen in a month according to their size ($X$: $1$ = Small, $2$ = Medium, $3$ = Large) and the number of visits to the vet in the…

A veterinary clinic classifies the dogs seen in a month according to their size ($X$: $1$ = Small, $2$ = Medium, $3$ = Large) and the number of visits to the vet in the last year ($Y$: $1, 2, 3$). The joint frequency table $n_{ij}$ is:

  • For $X=1$: $n_{11}=12$, $n_{12}=8$, $n_{13}=5$

  • For $X=2$: $n_{21}=10$, $n_{22}=15$, $n_{23}=10$

  • For $X=3$: $n_{31}=4$, $n_{32}=6$, $n_{33}=10$

Calculate the arithmetic mean and the variance of the marginal distribution of the number of visits ($Y$).

Solve
Practice★★☆Not started
In an agronomy study, the amount of fertiliser applied in kg/ha ($X$) and the crop yield in metric tons/ha ($Y$) are analysed. The following two-way table for the joint…

In an agronomy study, the amount of fertiliser applied in kg/ha ($X$) and the crop yield in metric tons/ha ($Y$) are analysed. The following two-way table for the joint frequencies $n_{ij}$ is available:

$X$ \ $Y$ $2$ $4$ $6$
10 $1$ $2$ $0$
20 $0$ $3$ $1$
30 $0$ $1$ $2$

Calculate the mean and standard deviation of the crop yield conditional on $20$ kg/ha of fertiliser having been applied (that is, from the distribution $Y | X=20$).

Solve

Statistical independence

Practice★★☆Not started
Two qualitative variables are analysed in a sample of $200$ tourists: continent of origin ($X$: European, American, Asian) and type of accommodation ($Y$: Hotel,…

Two qualitative variables are analysed in a sample of $200$ tourists: continent of origin ($X$: European, American, Asian) and type of accommodation ($Y$: Hotel, Apartment). The marginal relative frequencies are: European $50\%$, American $30\%$, Asian $20\%$. For accommodation: Hotel $60\%$, Apartment $40\%$. Assuming that both variables are statistically independent, how many tourists in the sample are expected to be American and stay in an apartment at the same time?

Solve
Practice★★★Not started
In a study on the relationship between the number of weekly hours spent playing sports ($X$) and the level of work stress ($Y$), the following joint absolute frequency…

In a study on the relationship between the number of weekly hours spent playing sports ($X$) and the level of work stress ($Y$), the following joint absolute frequency table is obtained, where $k$ is an unknown value:

$X$ \ $Y$ $2$ $5$ $8$
0 $1$ $2$ $3$
3 $2$ $4$ $k$
6 $1$ $2$ $3$

Mathematically determine the value of $k$ so that the variables $X$ and $Y$ are strictly statistically independent.

Solve

Scatter plot

For two numerical variables, each pair $(x_i,y_i)$ is drawn as a point in the Cartesian plane. The cloud of points shows whether there is a relationship and what kind.

Three scatter plots: direct correlation, inverse correlation, and no correlation. direct inverse no relationship
  • Direct (positive): as $X$ increases, $Y$ tends to increase.

  • Inverse (negative): as $X$ increases, $Y$ tends to decrease.

  • Strong: the points hug a line. Weak: the cloud is wide and scattered.

To calculate means from the graph, read the exact coordinates of each point (at the grid intersections) and build the table.

Simpson's paradox

Sometimes a trend that appears in every subgroup reverses when the data are combined. Look at two departments: within each one, more experience is associated with lower income; but department B has, on average, more experience and higher incomes than A.

Two clouds of points, each with a decreasing trend, but which together form an increasing trend. Dept. A Dept. B years of experience

With all the points together, the overall correlation would be positive (dotted line); separately, each department's is negative. The cause is a hidden third variable, the department. That's why you should always look at the graph before drawing conclusions.

Practice★☆☆Not started
Look at the following scatter plot relating weekly training hours ($X$) and time in seconds in a 100-meter sprint ($Y$) for a group of athletes. State whether the…

Look at the following scatter plot relating weekly training hours ($X$) and time in seconds in a 100-meter sprint ($Y$) for a group of athletes. State whether the correlation between both variables is positive or negative, and reason visually whether the linear dependence appears to be strong or weak.

X (hours) Y (sec) 2 4 6 8 10 12 14 16
Solve
Practice★★☆Not started
The following scatter plot represents the price in thousands of pesos ($Y$) against age in years ($X$) of a specific model of used van. From the points shown exactly on…

The following scatter plot represents the price in thousands of pesos ($Y$) against age in years ($X$) of a specific model of used van. From the points shown exactly on the grid intersections of the graph, construct the bivariate data table and calculate the marginal mean age $\bar{x}$ and the marginal mean price $\bar{y}$.

X Y 1 2 3 4 5 80 160 240 320
Solve
Practice★★★Not started
The following scatter plot shows the relationship between years of experience ($X$) and annual income in thousands of pesos ($Y$) for a group of professionals, divided…

The following scatter plot shows the relationship between years of experience ($X$) and annual income in thousands of pesos ($Y$) for a group of professionals, divided into two different departments (Department A in blue and Department B in green). Explain the concept of Simpson's paradox based on what you would observe if you calculated the overall correlation of all points combined, versus the local correlations for each department separately.

X Y 1 2 3 4 5 6 40 80 120 160 Dept A Dept B
Solve

Covariance

Covariance measures whether $X$ and $Y$ move together. It is the mean of the products of the deviations from the means:

Reconstructing a table using the covariance

Practice★☆☆Not started
The human resources department of an engineering firm has collected data on the years of experience ($X$) and monthly salary in thousands of pesos ($Y$) of its…

The human resources department of an engineering firm has collected data on the years of experience ($X$) and monthly salary in thousands of pesos ($Y$) of its employees. Given that the mean experience is $\bar{x} = 5$ years, the mean salary is $\bar{y} = 2.5$ thousand pesos, the sample size is $N = 20$ and the sum of cross-products is $\sum_{i=1}^{20} x_i y_i = 280$, calculate the covariance $\sigma_{xy}$.

Solve
Practice★★☆Not started
The following scatter plot shows the relationship between the force applied to a spring in Newtons ($X$) and its length in centimeters ($Y$). Given that the exact pairs…

The following scatter plot shows the relationship between the force applied to a spring in Newtons ($X$) and its length in centimeters ($Y$). Given that the exact pairs of values are $(1, 3)$, $(2, 5)$, $(3, 7)$ and $(4, 9)$, calculate the covariance $\sigma_{xy}$ and check analytically whether there is an exact functional relationship between both variables.

X Y 1 2 3 4 3 5 7 9
Solve
Practice★★★Not started
A bivariate table of two variables $X$ and $Y$ taking the values $X \in \{1, 2\}$ and $Y \in \{0, 1\}$ is given. The following overall statistical data are known: the…

A bivariate table of two variables $X$ and $Y$ taking the values $X \in \{1, 2\}$ and $Y \in \{0, 1\}$ is given. The following overall statistical data are known: the sample size is $N=100$, the marginal mean of $X$ is $\bar{x} = 1.4$, the marginal mean of $Y$ is $\bar{y} = 0.6$, and the covariance is $\sigma_{xy} = 0.06$. Using the definitions of these parameters, completely reconstruct the joint absolute frequency table $n_{ij}$.

Solve

Properties of covariance and of a sum

Changes of scale and origin

If $U=aX+b$ and $V=cY+d$, then $u_i-\bar u=a(x_i-\bar x)$ and $v_i-\bar v=c(y_i-\bar y)$. Multiplying and averaging:

$$\sigma_{uv}=ac\,\sigma_{xy}$$

Adding constants ($b$ and $d$) does not change the covariance: it only shifts the cloud. Multiplying by $a$ and $c$ rescales it. If $a$ and $c$ have opposite signs, the covariance changes sign.

Mean and variance of a sum

$$\bar z=\bar x+\bar y\qquad \text{Var}(X+Y)=\sigma_x^2+\sigma_y^2+2\sigma_{xy}$$

This comes from expanding $(x_i-\bar x+y_i-\bar y)^2$. If $\sigma_{xy}=0$, the variances simply add.

Back to the beginning: to find out whether studying more raises your grade, measure hours ($X$) and grade ($Y$), draw the cloud, and calculate $\sigma_{xy}$. If it is positive and the cloud hugs a line, studying more goes hand in hand with better grades. With the correlation coefficient in the next section you'll be able to say how strong that relationship is.

Practice★★★Not started
Let $X$ and $Y$ be two bivariate statistical variables with means $\bar{x}, \bar{y}$, standard deviations $\sigma_x, \sigma_y$ and covariance $\sigma_{xy}$. If a linear…

Let $X$ and $Y$ be two bivariate statistical variables with means $\bar{x}, \bar{y}$, standard deviations $\sigma_x, \sigma_y$ and covariance $\sigma_{xy}$. If a linear transformation of the form $U = 3X - 2$ and $V = -2Y + 5$ is applied to both variables, prove analytically what the value of the new covariance $\sigma_{uv}$ will be, expressed in terms of $\sigma_{xy}$.

Solve
Practice★★★Not started
In a tech company, the monthly base salary ($X$, in pesos) has a mean of $1500$ and a standard deviation of $200$. Commissions for completed projects ($Y$, in pesos)…

In a tech company, the monthly base salary ($X$, in pesos) has a mean of $1500$ and a standard deviation of $200$. Commissions for completed projects ($Y$, in pesos) have a mean of $300$ and a standard deviation of $100$. Given that the covariance between base salary and commissions is $\sigma_{xy} = 15000$, calculate the mean and variance of the total monthly salary $Z = X + Y$.

(Note: Recall the property of the variance of the sum of two correlated variables: $\text{Var}(X+Y) = \text{Var}(X) + \text{Var}(Y) + 2\text{Cov}(X,Y)$).

Solve

Summary

See all the exercises in this section