Conditional Distributions
The yearbook staff surveyed 32 students on their age and how many hours a week they practice a sport. Across the whole group, the average is about 4.2 hours. But does that describe the 14-year-olds? The 16-year-olds? To answer, you need to look at one group at a time. That is a conditional distribution, and by the end of this page you will compute it for the 14-year-olds and the 16-year-olds.
Slicing a Two-Way Table
Fixing a value of $Y$ works the same way, but you read a column instead.
Here are the survey results. $X$ is age and $Y$ is hours of sports practice per week.
| Age $X$ $\setminus$ Hours $Y$ | $2$ | $4$ | $6$ |
|---|---|---|---|
| $14$ | $5$ | $3$ | $1$ |
| $15$ | $2$ | $6$ | $4$ |
| $16$ | $1$ | $4$ | $6$ |
A bubble chart of a joint distribution holds the same information as the table. Each bubble is one cell, and its label is the joint frequency $f_{ij}$. To condition on $X = x_i$, keep only the bubbles above that $x$-value and ignore the rest.
Given the following two-way table relating the variables $X$ and $Y$: | $X \setminus Y$ | $1$ | $2$ | $3$ | | :---: | :---: | :---: | :---: | | $10$ | $2$ | $5$ | $1$ |…
Given the following two-way table relating the variables $X$ and $Y$:
| $X \setminus Y$ | $1$ | $2$ | $3$ |
|---|---|---|---|
| $10$ | $2$ | $5$ | $1$ |
| $20$ | $0$ | $4$ | $3$ |
| $30$ | $4$ | $1$ | $0$ |
Write the frequency table for the distribution of the variable $Y$ conditional on $X = 10$ and calculate the size of this subpopulation.
In a study on two variables $X$ and $Y$, the distribution of $Y$ conditional on a specific value $x_i$ has been isolated, obtaining the following absolute frequencies: |…
In a study on two variables $X$ and $Y$, the distribution of $Y$ conditional on a specific value $x_i$ has been isolated, obtaining the following absolute frequencies:
| $Y | X = x_i$ | Absolute frequency ($f_{j|i}$) |
|---|---|
| $100$ | $4$ |
| $200$ | $12$ |
| $300$ | $4$ |
Calculate the conditional relative frequencies $h_{j|i}$ for each value of $Y$ and check that they add up to $1$.
The following bubble chart represents the joint distribution of two discrete variables $X$ and $Y$. The size of the bubble and the adjacent text indicate the joint…
The following bubble chart represents the joint distribution of two discrete variables $X$ and $Y$. The size of the bubble and the adjacent text indicate the joint absolute frequency $f_{ij}$ of each pair of values $(x_i, y_j)$.
Extract the frequency table for the distribution of $X$ conditional on $Y = 20$ and calculate its arithmetic mean $\bar{x}_{|y=20}$.
Conditional Mean and Mode
Once you have isolated a row, find its mean and mode the way you always do. Use only the numbers in that row.
Observe the following contingency table: | $X \setminus Y$ | $10$ | $20$ | $30$ | $40$ | | :---: | :---: | :---: | :---: | :---: | | $1$ | $1$ | $8$ | $2$ | $0$ | | $2$…
Observe the following contingency table:
| $X \setminus Y$ | $10$ | $20$ | $30$ | $40$ |
|---|---|---|---|---|
| $1$ | $1$ | $8$ | $2$ | $0$ |
| $2$ | $5$ | $3$ | $9$ | $1$ |
| $3$ | $2$ | $2$ | $4$ | $7$ |
Determine the mode of the distribution of $Y$ conditional on $X = 2$ and the mode of the distribution of $X$ conditional on $Y = 30$.
From the joint distribution of the variables $X$ and $Y$ given in the table: | $X \setminus Y$ | $0$ | $5$ | | :---: | :---: | :---: | | $2$ | $10$ | $2$ | | $4$ | $8$ |…
From the joint distribution of the variables $X$ and $Y$ given in the table:
| $X \setminus Y$ | $0$ | $5$ |
|---|---|---|
| $2$ | $10$ | $2$ |
| $4$ | $8$ | $6$ |
| $6$ | $1$ | $12$ |
Calculate the arithmetic mean of the distribution of $X$ conditional on $Y = 5$, that is, $\bar{x}_{|y=5}$.
The number of spelling mistakes ($Y$) in a dictation is analyzed according to the grade level ($X$). The two conditional distributions for $X=3$ and $X=4$ are extracted:…
The number of spelling mistakes ($Y$) in a dictation is analyzed according to the grade level ($X$). The two conditional distributions for $X=3$ and $X=4$ are extracted:
Distribution $Y | X=3$:
Values $y_j$: $0, 1, 2, 3$
Frequencies: $2, 5, 2, 1$
Distribution $Y | X=4$:
Values $y_j$: $0, 1, 2, 3$
Frequencies: $5, 3, 2, 0$
Calculate the mean number of mistakes in each grade level ($\bar{y}_{|x=3}$ and $\bar{y}_{|x=4}$) and indicate in which grade level, on average, fewer mistakes are made.
Conditional Variance and Standard Deviation
The mean says where the group is centered. The variance and standard deviation say how spread out it is. For a conditional distribution you use only the frequencies in the row or column you isolated.
Explore it with the 9th-grade absence data. Edit the numbers and watch the mean and spread change.
The conditional distribution of a variable $Y$ for a specific group $X = a$ has been extracted, resulting in the following data: The size of the group is…
The conditional distribution of a variable $Y$ for a specific group $X = a$ has been extracted, resulting in the following data:
The size of the group is $N_{|x=a} = 20$.
The sum of the values is $\sum f_{j|a} \cdot y_j = 160$.
The sum of the squares is $\sum f_{j|a} \cdot y_j^2 = 1400$.
Calculate the conditional variance $\sigma^2_{Y|X=a}$.
In a nutrition study, the carbohydrate content in grams ($X$) and the protein content in grams ($Y$) of several energy bars are related. The results are grouped in the…
In a nutrition study, the carbohydrate content in grams ($X$) and the protein content in grams ($Y$) of several energy bars are related. The results are grouped in the following table:
| $X \setminus Y$ | $5$ | $10$ | $15$ |
|---|---|---|---|
| $20$ | $8$ | $12$ | $0$ |
| $30$ | $2$ | $15$ | $5$ |
| $40$ | $0$ | $4$ | $14$ |
Calculate the mean and standard deviation of the protein content for those bars that have exactly $30\text{ g}$ of carbohydrates (distribution $Y|X=30$).
On a farm, the amount of fertilizer applied per acre ($X$, in tens of pounds) and the yield obtained ($Y$, in tons) are analyzed. | $X \setminus Y$ | $2$ | $4$ | $6$ | |…
On a farm, the amount of fertilizer applied per acre ($X$, in tens of pounds) and the yield obtained ($Y$, in tons) are analyzed.
| $X \setminus Y$ | $2$ | $4$ | $6$ |
|---|---|---|---|
| $1$ | $5$ | $1$ | $0$ |
| $2$ | $2$ | $8$ | $2$ |
| $3$ | $0$ | $3$ | $9$ |
Calculate the variance of the production conditional on $20\text{ lb}$ of fertilizer having been applied ($\sigma^2_{Y|X=2}$).
Comparing Spread: Coefficient of Variation
Is a standard deviation of $6$ big or small? It depends on the mean. A spread of $6$ minutes matters if the mean is $15$ minutes, and matters much less if the mean is $40$. The coefficient of variation measures spread relative to the mean.
Given the distribution of the variable $X$ conditional on $Y = 10$: | $X | Y = 10$ | $2$ | $4$ | $6$ | | :---: | :---: | :---: | :---: | | $f_{i|10}$ | $3$ | $5$ | $2$ |…
Given the distribution of the variable $X$ conditional on $Y = 10$:
| $X | Y = 10$ | $2$ | $4$ | $6$ |
|---|---|---|---|
| $f_{i|10}$ | $3$ | $5$ | $2$ |
Knowing that the conditional mean is $\bar{x}_{|y=10} = 3,8$, calculate the conditional standard deviation $\sigma_{X|Y=10}$.
In a factory, two different machines ($X=1$ and $X=2$) produce the same type of part. The number of defects per batch ($Y$) is analyzed. For Machine 1 ($X=1$):…
In a factory, two different machines ($X=1$ and $X=2$) produce the same type of part. The number of defects per batch ($Y$) is analyzed.
For Machine 1 ($X=1$): $\bar{y}_{|x=1} = 2,5$ defects, $\sigma_{Y|X=1} = 0,5$ defects.
For Machine 2 ($X=2$): $\bar{y}_{|x=2} = 8,0$ defects, $\sigma_{Y|X=2} = 1,2$ defects.
Calculate the conditional coefficient of variation for each machine ($CV = \frac{\sigma}{|\bar{y}|}$) and indicate which machine has a more homogeneous production in terms of the number of defects.
A financial analyst studies the relationship between the risk level of an investment fund ($X$, scored from $1$ to $3$) and its annual return ($Y$, in %). |…
A financial analyst studies the relationship between the risk level of an investment fund ($X$, scored from $1$ to $3$) and its annual return ($Y$, in %).
| $X \setminus Y$ | $2$ | $6$ | $10$ |
|---|---|---|---|
| $1$ | $10$ | $10$ | $0$ |
| $2$ | $5$ | $20$ | $5$ |
| $3$ | $0$ | $5$ | $15$ |
The analyst defines the "performance ratio" of a risk level as the quotient between its conditional mean return and its conditional standard deviation: $R_i = \frac{\bar{y}_{|x=i}}{\sigma_{Y|X=i}}$.
Calculate this ratio for the risk levels $X=2$ and $X=3$. Which risk level offers a better ratio according to this criterion?
Grouped Data and Midpoints
Sometimes a variable is given in intervals, like $[0, 2)$ or $[40, 60)$. To compute a mean or variance, replace each interval by its midpoint, the average of its two endpoints. Some problems call this the class mark.
$$\text{midpoint} = \frac{\text{lower end} + \text{upper end}}{2}$$This works whether the intervals have equal widths or not. The results are approximations, because we pretend every value in an interval sits at its midpoint.
When the condition itself is an interval, such as "wind speed in $[40, 60)$ mph," that is just one row of the table. The values of the other variable still use midpoints.
The Department of Motor Vehicles has compiled data on the age of drivers ($X$, in years) and the number of traffic tickets received in the last year ($Y$): |…
The Department of Motor Vehicles has compiled data on the age of drivers ($X$, in years) and the number of traffic tickets received in the last year ($Y$):
| $X \setminus Y$ | $0$ | $1$ | $2$ |
|---|---|---|---|
| $[18, 30)$ | $15$ | $25$ | $10$ |
| $[30, 50)$ | $40$ | $15$ | $5$ |
| $[50, 70)$ | $35$ | $5$ | $0$ |
Using the class mark for the variable $X$, calculate the mean age of the drivers who have received exactly $1$ ticket in the last year ($\bar{x}_{|y=1}$).
In a weather station, the maximum wind speed ($X$, in mph) and the relative humidity ($Y$, in %) are recorded. The data are grouped into two-dimensional intervals: |…
In a weather station, the maximum wind speed ($X$, in mph) and the relative humidity ($Y$, in %) are recorded. The data are grouped into two-dimensional intervals:
| $X \setminus Y$ | $[40, 60)$ | $[60, 80)$ | $[80, 100)$ |
|---|---|---|---|
| $[0, 20)$ | $2$ | $10$ | $18$ |
| $[20, 40)$ | $5$ | $15$ | $6$ |
| $[40, 60)$ | $12$ | $4$ | $0$ |
Using the class marks, calculate the mean relative humidity on those days when the wind speed was between $40$ and $60\text{ mph}$ ($\bar{y}_{|x \in [40, 60)}$).
In a marine biology study, the depth at which a species lives ($X$, in feet) is related to its length ($Y$, in inches). The data are grouped into intervals of different…
In a marine biology study, the depth at which a species lives ($X$, in feet) is related to its length ($Y$, in inches). The data are grouped into intervals of different widths:
| $X \setminus Y$ | $[0, 10)$ | $[10, 30)$ | $[30, 70)$ |
|---|---|---|---|
| $[0, 50)$ | $24$ | $10$ | $2$ |
| $[50, 150)$ | $6$ | $18$ | $16$ |
Using the class marks, calculate the variance of the length for the specimens living in the deep zone ($X \in [50, 150)$), that is, $\sigma^2_{Y|X \in [50, 150)}$.
Statistical Independence
Now suppose 11th graders had counts $30, 10, 10$ ($N = 50$). Then their relative frequencies would be $0.6, 0.2, 0.2$. That distribution is different, so the variables would be dependent.
There is a second way to say the same thing. For independent variables, every joint relative frequency equals the product of the two marginal ones, so $f_{ij} = \dfrac{(\text{row total})(\text{column total})}{N}$. One consequence is that all the conditional means equal the marginal mean.
In a two-way table, the following conditional relative frequencies are given for the variable $Y$ with respect to two values of $X$: For $X = 1$: $h_{1|1} = 0,2$ ;…
In a two-way table, the following conditional relative frequencies are given for the variable $Y$ with respect to two values of $X$:
For $X = 1$: $h_{1|1} = 0,2$ ; $h_{2|1} = 0,8$
For $X = 2$: $h_{1|2} = 0,5$ ; $h_{2|2} = 0,5$
Reason whether the variables $X$ and $Y$ are statistically independent or dependent based exclusively on these data.
A survey is carried out in a high school asking about gender ($X$: $1=\text{Chico}$, $2=\text{Chica}$) and preferred social network ($Y$: $1=\text{TikTok}$,…
A survey is carried out in a high school asking about gender ($X$: $1=\text{Chico}$, $2=\text{Chica}$) and preferred social network ($Y$: $1=\text{TikTok}$, $2=\text{Instagram}$, $3=\text{BeReal}$).
| $X \setminus Y$ | $1$ | $2$ | $3$ |
|---|---|---|---|
| $1$ | $30$ | $20$ | $10$ |
| $2$ | $45$ | $30$ | $15$ |
Calculate the conditional relative frequency distributions $Y|X=1$ and $Y|X=2$. In view of the results, are gender and preferred social network independent in this sample?
Show numerically a fundamental property of statistical independence. Given the following table where $X$ and $Y$ are independent (their joint relative frequencies are…
Show numerically a fundamental property of statistical independence. Given the following table where $X$ and $Y$ are independent (their joint relative frequencies are the product of the marginal ones):
| $X \setminus Y$ | $2$ | $4$ | Total |
|---|---|---|---|
| $1$ | $10$ | $30$ | $40$ |
| $2$ | $15$ | $45$ | $60$ |
| Total | $25$ | $75$ | $100$ |
Calculate the marginal mean $\bar{y}$ and the conditional means $\bar{y}_{|x=1}$ and $\bar{y}_{|x=2}$. Check that, being independent, the equality $\bar{y} = \bar{y}_{|x=1} = \bar{y}_{|x=2}$ holds.
Finding Missing Frequencies
Sometimes a frequency is unknown, but you are told a conditional mean. Write the mean formula, put the unknown $k$ in it, and solve the linear equation.
With two unknowns, you need two conditions. For example, you might know one conditional mean for a row and another for a column. Write one equation for each condition. If both unknowns appear in the same equation, solve the system by substitution or elimination. Check each answer by recomputing the mean.
In a study on video games, the number of hours played per week ($X$) is related to the level reached in the game ($Y$). For the group of players who dedicate $10$ hours…
In a study on video games, the number of hours played per week ($X$) is related to the level reached in the game ($Y$). For the group of players who dedicate $10$ hours ($X=10$), the following incomplete distribution is given:
| $Y | X = 10$ | $5$ | $15$ | $25$ |
|---|---|---|---|
| $f_{j|10}$ | $4$ | $k$ | $2$ |
Knowing that the mean level reached by this group is $\bar{y}_{|x=10} = 13$, set up an equation and determine the value of the unknown absolute frequency $k$.
Given the following contingency table with two unknown absolute frequencies, $a$ and $b$: | $X \setminus Y$ | $2$ | $6$ | | :---: | :---: | :---: | | $10$ | $4$ | $a$ |…
Given the following contingency table with two unknown absolute frequencies, $a$ and $b$:
| $X \setminus Y$ | $2$ | $6$ |
|---|---|---|
| $10$ | $4$ | $a$ |
| $20$ | $b$ | $2$ |
It is known that the mean of $Y$ conditional on $X=10$ is $\bar{y}_{|x=10} = 5$, and that the mean of $X$ conditional on $Y=2$ is $\bar{x}_{|y=2} = 16$.
Set up a system of equations and determine the values of the frequencies $a$ and $b$.
Rebuilding a Table from Its Totals
You can also reconstruct a whole table from marginal totals plus one conditional fact. When $Y$ takes only the values $0$ and $1$, the mean equals the proportion of ones, so the conditional mean tells you how many ones are in that row.
We wish to reconstruct a $2 \times 2$ contingency table of absolute frequencies $f_{ij}$ for the variables $X \in \{0, 1\}$ and $Y \in \{0, 1\}$. The following…
We wish to reconstruct a $2 \times 2$ contingency table of absolute frequencies $f_{ij}$ for the variables $X \in \{0, 1\}$ and $Y \in \{0, 1\}$. The following information is available about the marginal and conditional distributions:
-
Marginal of $X$: $N_{x=0} = 30$, $N_{x=1} = 20$.
-
Marginal of $Y$: $N_{y=0} = 25$, $N_{y=1} = 25$.
-
Conditional mean: $\bar{y}_{|x=0} = 0,3$ (remember that since $Y$ takes values $0$ and $1$, the mean coincides with the proportion of ones).
Calculate the four joint frequencies $f_{11}, f_{12}, f_{21}, f_{22}$ and construct the complete two-way table.
A theoretical two-dimensional distribution of joint relative frequencies (probabilities) is given by the expression $h_{ij} = k \cdot (x_i + y_j)$, where $X$ takes the…
A theoretical two-dimensional distribution of joint relative frequencies (probabilities) is given by the expression $h_{ij} = k \cdot (x_i + y_j)$, where $X$ takes the values $\{1, 2\}$ and $Y$ takes the values $\{1, 2, 3\}$.
Construct the two-way table in terms of $k$. Knowing that the sum of all relative frequencies must be $1$, find the value of $k$. Subsequently, calculate the mean of the conditional distribution $X|Y=2$.
Putting the Groups Back Together
Suppose you only know each group's size, mean and variance. You can still get the overall mean and variance.
In a statistical study on the variable $X$ (job category) and $Y$ (salary in thousands of dollars), there are three categories ($X=1, 2, 3$). The following data are…
In a statistical study on the variable $X$ (job category) and $Y$ (salary in thousands of dollars), there are three categories ($X=1, 2, 3$). The following data are known for the conditional distributions $Y|X=x_i$:
Category 1: $N_1 = 10$, $\bar{y}_{|x=1} = 20$, $\sigma^2_{Y|X=1} = 4$
Category 2: $N_2 = 20$, $\bar{y}_{|x=2} = 30$, $\sigma^2_{Y|X=2} = 9$
Category 3: $N_3 = 10$, $\bar{y}_{|x=3} = 40$, $\sigma^2_{Y|X=3} = 4$
First calculate the overall marginal mean $\bar{y}$. Next, calculate the marginal variance $\sigma_Y^2$ using the variance decomposition formula (or by calculating the total sum of squares from the given data).
Careful: Groups vs. Overall (Simpson's Paradox)
Weights matter. A conclusion that is true inside every group can flip when you merge the groups.
When $Y$ is $0/1$ (like "made the shot" or "cured"), the mean $\bar{y}$ is the percent of ones. So a success rate is just a conditional mean.
A new treatment is tested in a hospital. The variable $X$ indicates the treatment ($0=\text{Estándar}$, $1=\text{Nuevo}$) and the variable $Y$ indicates the outcome…
A new treatment is tested in a hospital. The variable $X$ indicates the treatment ($0=\text{Estándar}$, $1=\text{Nuevo}$) and the variable $Y$ indicates the outcome ($0=\text{No curado}$, $1=\text{Curado}$). The patients are divided into two risk groups, forming two conditional distributions:
Low Risk Group:
Standard Treatment: $10$ cured out of $50$ patients.
New Treatment: $2$ cured out of $10$ patients.
High Risk Group:
Standard Treatment: $6$ cured out of $10$ patients.
New Treatment: $25$ cured out of $50$ patients.
Calculate the cure percentage (which is equivalent to the mean $\bar{y}$) for each treatment within each risk group. Then, group all the patients and calculate the overall cure percentage for each treatment. Which treatment seems better in the separate groups and which seems better overall? (This phenomenon is known as Simpson's Paradox).
Back to the start: The 14-year-old row of the yearbook survey is $5, 3, 1$ for $Y = 2, 4, 6$ hours, so $\bar{y}_{|x=14} = \dfrac{10 + 12 + 6}{9} = \dfrac{28}{9} \approx 3.1$ hours. The 16-year-old row is $1, 4, 6$, so $\bar{y}_{|x=16} = \dfrac{2 + 16 + 36}{11} = \dfrac{54}{11} \approx 4.9$ hours. The overall average of about $4.2$ hours hides a big difference between the two ages.