Tutorials › VEE Mathematical Statistics › Testing Independence in Continuous Models

VEE Mathematical Statistics · Joint Distributions and Marginals · Tutorial 277 of 880

Testing Independence in Continuous Models

Derive marginal densities and use joint-density factorization to decide whether continuous random variables are independent.

Intermediate 10 min read

What You'll Learn

  • Compute marginal densities by integrating a joint density over the other variable.
  • State the density-factorization criterion for independence, including its almost-everywhere qualification.
  • Check normalization before treating a proposed function as a joint density.
  • Verify independence by comparing the joint density with the product of the marginals.
  • Recognize why a single valid point of inequality establishes dependence.
  • Avoid common mistakes involving triangular supports and marginal-product arithmetic.

Why Compare Densities?

For two continuous random variables, knowing the marginal distribution of each variable does not by itself tell us whether they are independent. The joint density contains the information about how their values occur together. A direct test is to derive the two marginal densities and compare their product with the joint density.

The key requirement is factorization: under the usual assumption that the pair has a joint density, independence holds exactly when the joint density equals the product of the marginal densities almost everywhere. The support matters in performing the integrations and in deciding where the equality must hold. A proposed function must also be a valid density before it can be used in this test.

Definition: Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)\). Its marginal densities are $$ f_X(x)=\int_{-\infty}^{\infty} f_{X,Y}(x,y)\,dy, \qquad f_Y(y)=\int_{-\infty}^{\infty} f_{X,Y}(x,y)\,dx. $$ The variables \(X\) and \(Y\) are independent if and only if $$ f_{X,Y}(x,y)=f_X(x)f_Y(y) $$ for almost every \((x,y)\) in the plane. “Almost every” allows differences on sets of area zero, such as boundary lines, which do not affect probabilities.

In practice, the support determines the effective integration limits for each marginal. After finding both marginals, compare their product with the joint density on the joint support and account for points outside it as well. If the two sides differ on a region with positive area, the variables are dependent. If they agree except possibly on a set of area zero, they are independent.

Why the Factorization Criterion Works

The criterion follows from how densities calculate probabilities. For any measurable sets \(A\) and \(B\), if the joint density factors, then

$$ \begin{aligned} P(X\in A,\ Y\in B) &=\int_A\int_B f_{X,Y}(x,y)\,dy\,dx\\ &=\int_A\int_B f_X(x)f_Y(y)\,dy\,dx\\ &=\left(\int_A f_X(x)\,dx\right) \left(\int_B f_Y(y)\,dy\right)\\ &=P(X\in A)P(Y\in B). \end{aligned} $$

That is the defining property of independence: probabilities for events about \(X\) and \(Y\) multiply. Conversely, if \(X\) and \(Y\) are independent and have densities, their joint probabilities over every rectangle \(A\times B\) equal the probabilities calculated from the product density \(f_X(x)f_Y(y)\). The joint density and that product therefore describe the same distribution, so they are equal almost everywhere. Density values at isolated points or along boundaries cannot overturn the conclusion.

Worked Examples

Worked Example: A Constant Density on a Triangle

A hypothetical model for two continuous measurements has joint density \(f_{X,Y}(x,y)=2\) when \(0<y<x<1\), and zero elsewhere. Confirm that it is a valid density, find the marginals, and test independence. This is the specified triangular-support density model with no additional parameters; no interest rate or mortality assumption is involved.

Method and normalization. Integrate over the full triangular support:

$$ \int_0^1\int_0^x 2\,dy\,dx =\int_0^1 2x\,dx =\left[x^2\right]_0^1 =1. $$

The function is nonnegative and its integral is 1, so it is a valid joint density.

Find \(f_X\). For a fixed \(x\) between 0 and 1, the allowed values of \(y\) are between 0 and \(x\):

$$ f_X(x)=\int_0^x 2\,dy=2x,\qquad 0<x<1. $$

Find \(f_Y\). For a fixed \(y\) between 0 and 1, the allowed values of \(x\) are between \(y\) and 1:

$$ f_Y(y)=\int_y^1 2\,dx=2(1-y),\qquad 0<y<1. $$

Each marginal integrates to 1: \(\int_0^1 2x\,dx=1\), and \(\int_0^1 2(1-y)\,dy=1\). Now test factorization at the interior point \(x=3/4,\ y=1/4\), which lies in the support because \(0<1/4<3/4<1\):

$$ f_{X,Y}(3/4,1/4)=2, \qquad f_X(3/4)f_Y(1/4) =\left(2\cdot\frac34\right)\left(2\cdot\frac34\right) =\frac32\cdot\frac32 =\frac94. $$

The values differ, so the densities cannot factor almost everywhere and \(X\) and \(Y\) are dependent. Common mistake avoided: the product is \(9/4\), not \(9/8\). Also, replacing the density constant 2 by 3 would not give a valid density: its integral over this triangle would be \(3/2\), not 1.

Worked Example: Factorization on a Rectangular Support

A hypothetical pair of measurements has density $$ f_{X,Y}(x,y)=\frac{4}{3}(1+x)y,\qquad 0<x<1,\quad 0<y<1, $$ and density zero elsewhere. Determine whether the variables are independent and calculate \(P(X>1/2,\ Y<1/2)\). This model is specified by the displayed joint density on the unit square; there are no interest or mortality assumptions.

Check the model. The density is nonnegative on its support, and

$$ \int_0^1\int_0^1 \frac43(1+x)y\,dy\,dx =\frac43\left(\int_0^1(1+x)\,dx\right) \left(\int_0^1y\,dy\right) =\frac43\cdot\frac32\cdot\frac12 =1. $$

Find the marginals. Integrate out \(y\) for the density of \(X\), and \(x\) for the density of \(Y\):

$$ \begin{aligned} f_X(x) &=\int_0^1 \frac43(1+x)y\,dy =\frac43(1+x)\cdot\frac12 =\frac23(1+x),\\ f_Y(y) &=\int_0^1 \frac43(1+x)y\,dx =\frac43y\cdot\frac32 =2y. \end{aligned} $$

Both marginals are normalized: \(\int_0^1\frac23(1+x)\,dx=1\) and \(\int_0^1 2y\,dy=1\). Their product is

$$ f_X(x)f_Y(y)=\frac23(1+x)\cdot 2y=\frac43(1+x)y=f_{X,Y}(x,y) $$

throughout the square. Outside the square, the joint density is zero, and the product of the marginals is also zero because at least one marginal density is zero there. Thus the factorization criterion holds and \(X\) and \(Y\) are independent.

For the requested probability, independence gives

$$ \begin{aligned} P(X>1/2) &=\int_{1/2}^1 \frac23(1+x)\,dx =\frac23\left[\ x+\frac{x^2}{2}\right]_{1/2}^1\\ &=\frac23\left(\frac32-\frac58\right) =\frac23\cdot\frac78 =\frac7{12},\\ P(Y<1/2)&=\int_0^{1/2}2y\,dy=\left[y^2\right]_0^{1/2}=\frac14,\\ P(X>1/2,\ Y<1/2)&=\frac7{12}\cdot\frac14=\frac7{48}. \end{aligned} $$

As a check, direct integration of the joint density over the requested rectangle gives \(\int_0^{1/2}\int_{1/2}^1\frac43(1+x)y\,dx\,dy=\frac7{48}\), the same result. The method uses the factorization to simplify the event probability; it avoids treating the two event restrictions as if they were automatically independent before that factorization has been verified.

Worked Example: A Normalized Density That Does Not Factor

Consider the hypothetical joint density $$ f_{X,Y}(x,y)=\frac45(1+xy),\qquad 0<x<1,\quad 0<y<1, $$ and zero elsewhere. Determine whether \(X\) and \(Y\) are independent. The joint model has the displayed interaction term and normalization constant \(4/5\); no interest or mortality assumptions apply.

First check normalization:

$$ \int_0^1\int_0^1\frac45(1+xy)\,dy\,dx =\frac45\left(1+\frac14\right)=1. $$

Next, integrate to find the marginals:

$$ \begin{aligned} f_X(x) &=\int_0^1\frac45(1+xy)\,dy =\frac45\left(1+\frac{x}{2}\right) =\frac25(2+x),\\ f_Y(y) &=\int_0^1\frac45(1+xy)\,dx =\frac45\left(1+\frac{y}{2}\right) =\frac25(2+y). \end{aligned} $$

Test an interior point, \(x=1/5,\ y=3/5\):

$$ \begin{aligned} f_{X,Y}(1/5,3/5) &=\frac45\left(1+\frac{3}{25}\right) =\frac{112}{125} =0.896,\\ f_X(1/5)f_Y(3/5) &=\left(\frac{22}{25}\right)\left(\frac{26}{25}\right) =\frac{572}{625} =0.9152. \end{aligned} $$

These values are unequal at an interior point, and the difference persists in a neighborhood of that point because both expressions are continuous. Thus they differ on a region of positive area, so \(X\) and \(Y\) are dependent. The method is to normalize, obtain both marginals, then compare; checking only whether the joint density itself looks simple would not establish independence.

How to Apply the Test Reliably

1
Validate the joint density.
Check nonnegativity and integrate over the stated support. The integral must equal 1 before the function represents a probability density.
2
Find both marginals.
For \(f_X\), integrate out \(y\); for \(f_Y\), integrate out \(x\). Use the support to set the correct limits, and include zero values outside each marginal's range.
3
Form the marginal product.
Calculate \(f_X(x)f_Y(y)\) explicitly. Do not assume the product has the same support or algebraic form as the joint density.
4
Compare and conclude.
If the expressions differ on a region with positive area, the variables are dependent. If they agree almost everywhere on the plane, they are independent.

A single point can be an efficient way to establish dependence when the densities are continuous in the region: a strict difference at an interior point then continues in a sufficiently small neighborhood. For general densities, however, a disagreement at only one point is not enough, because density values can be changed on sets of area zero without changing the distribution. In an exam solution, choose an interior point in a region where the formulas are continuous, or show directly that the expressions differ on a positive-area region.

Common Mistakes and Exam Traps

  • Skipping normalization. A nonnegative function is not automatically a density. For instance, the constant 3 on \(0<y<x<1\) has integral \(3/2\), so it cannot be used as a joint probability density without changing it.
  • Using incorrect marginal limits. For the support \(0<y<x<1\), fixing \(x\) gives \(0<y<x\), while fixing \(y\) gives \(y<x<1\). Reversing one of these limits changes the marginal.
  • Multiplying the marginal values incorrectly. In the triangular example, \(f_X(3/4)=3/2\) and \(f_Y(1/4)=3/2\), so their product is \(9/4\), not \(9/8\).
  • Confusing a necessary visual clue with a complete test. A complicated-looking density can factor, and a simple-looking density can fail to factor. Calculate the marginals rather than relying on appearance.
  • Demanding equality at every boundary point. Densities are defined up to changes on sets of area zero. The criterion is equality almost everywhere, not necessarily at every point of a chosen formula's boundary.
Key takeaway: For a pair with a joint density, test independence by finding both marginal densities and checking whether their product equals the joint density almost everywhere. First verify normalization, and use the support to integrate correctly.

Check Your Understanding

For each model, verify the relevant marginal calculations before deciding whether the variables are independent.

  1. A pair has density \(f_{X,Y}(x,y)=2x\) for \(0<x<1,\ 0<y<1\), and zero elsewhere. Find the marginals, decide independence, and calculate \(P(X>1/2,\ Y<1/4)\). (Answer: \(f_X(x)=2x,\ f_Y(y)=1\); independent; probability \(1/8\).)
  2. A pair has density 2 on \(0<x<y<1\), and zero elsewhere. Find the marginals and decide independence. (Answer: \(f_X(x)=2(1-x),\ f_Y(y)=2y\) on \((0,1)\); dependent.)
  3. A pair has density \(4xy\) on the unit square, and zero elsewhere. Verify normalization, decide independence, and calculate \(P(X<1/2,\ Y>1/2)\). (Answer: normalized; \(f_X(x)=2x,\ f_Y(y)=2y\), so independent; probability \(3/16\).)
  4. A pair has density \(\frac25(1+x+2y)\) on the unit square, and zero elsewhere. Find the marginals and decide independence. (Answer: \(f_X(x)=\frac25(2+x)\), \(f_Y(y)=\frac35+\frac45y\); dependent, since at \((0,0)\) the joint density is \(2/5\) while the marginal product is \(6/25\).)
  5. A pair has density \(x(1-y)\) for \(0<x<2,\ 0<y<1\), and zero elsewhere. Find the marginals and calculate \(P(X>1,\ Y<1/2)\). (Answer: \(f_X(x)=x/2,\ f_Y(y)=2(1-y)\); independent; probability \(9/16\).)
Clinical Biostats