Ancillary Statistics & Basu's Theorem in R: Advanced Statistical Theory
An ancillary statistic is a function of the sample whose distribution does not depend on the unknown parameter. Basu's theorem is the bridge that connects this idea to sufficiency: if a statistic is complete and sufficient, it is independent of every ancillary statistic.
What is an ancillary statistic?
The idea sounds paradoxical at first. A statistic built from data that carries no information about the parameter you care about? To see why that is useful, we will start with a location family. Shift the distribution up and down along the number line, and watch what stays put. That is the signature of ancillarity, and we can spot it in one short simulation.
Consider the uniform distribution $U(\mu, \mu + 1)$. Here $\mu$ is a location parameter: changing $\mu$ slides the whole distribution left or right without changing its shape. The range of a sample, $R = X_{(n)} - X_{(1)}$, is the difference between the largest and smallest observations. Because every observation shifts by the same amount when $\mu$ changes, their difference does not move at all.
The two rows are nearly identical, and the tiny gap is Monte Carlo noise rather than a real signal. Shifting the uniform distribution by ten units does not change the distribution of the range. In the language of theory, the range is ancillary for the location parameter $\mu$. It carries information about the spread of the sample, but none about where the sample lives on the number line.
Try it: Modify the simulation so the uniform span is $U(\mu, \mu + 2)$ instead of width one. Verify the range is still ancillary for $\mu$.
Click to reveal solution
Explanation: Doubling the width just rescales the range, but the distribution still does not depend on $\mu$ because $\mu$ only translates the endpoints.
How is ancillary different from sufficient?
Sufficient and ancillary statistics sit at opposite ends of an information spectrum. A sufficient statistic condenses all parameter information in the sample. An ancillary statistic carries none of it. Everything else lives somewhere in between.
Here is a compact contrast of the three concepts that matter in this post.
| Concept | Depends on $\theta$? | Intuition |
|---|---|---|
| Sufficient | Yes, fully. Contains all information about $\theta$. | Conditional on $T$, the rest of the data tells you nothing more. |
| Ancillary | No. Its distribution is the same for every $\theta$. | Knowing $V$ tells you nothing about $\theta$. |
| Complete | Extra condition on sufficient. | No non-trivial function of $T$ has mean zero for every $\theta$. |
To make this concrete, take a Poisson sample with rate $\lambda$. The total $\sum X_i$ is sufficient for $\lambda$, because once we know the total the individual $X_i$ values are a multinomial draw whose distribution no longer involves $\lambda$. Let us verify the sufficiency claim by looking at a conditional distribution.
The two rows are almost identical because they are both sampling from the same theoretical distribution: the conditional of $X_1$ given $\sum X_i = 10$ is Binomial$(10, 1/n)$, with no $\lambda$ inside. This is exactly what sufficiency means operationally.
Try it: For a normal sample $X_i \sim N(\mu, 1)$, the sample mean is sufficient for $\mu$. Verify sufficiency empirically by fixing the observed mean at, say, $\bar{x} = 0$ and checking that the conditional distribution of $X_1 - \bar{x}$ does not depend on $\mu$.
Click to reveal solution
Explanation: Conditional on the sample mean, the residual $X_1 - \bar{X}$ has a distribution that does not depend on $\mu$. That is the empirical fingerprint of a sufficient statistic.
What does Basu's theorem state?
Basu's theorem is a one-sentence result with surprising reach. Here is the statement.
Basu's Theorem. If $T(X)$ is complete and sufficient for $\theta$, and $V(X)$ is ancillary, then $T$ and $V$ are independent for every value of $\theta$.
The intuition runs in three steps. First, $T$ has absorbed all of the parameter information, so the conditional distribution of $V$ given $T = t$ cannot be shifted around by $\theta$. Second, $V$ is ancillary, so its marginal distribution also does not depend on $\theta$. Third, completeness forces these two distributions to agree exactly, not just on average. The formal statement of the agreement is short and sharp.
$$P(V \in A \mid T = t) = P(V \in A) \quad \text{for every } t, \text{ every } A.$$
Where:
- $T$ is the complete sufficient statistic
- $V$ is the ancillary statistic
- $A$ is any measurable event in the sample space of $V$
When the conditional and the marginal are identical, independence follows by definition. That is the whole theorem in a line.
A clean way to see independence in R is with an empirical independence helper that checks two things at once: the linear correlation between $T$ and $V$, and a contingency-table $\chi^2$ test on their quantile bins. If both signals are weak, we have no evidence against independence.
A correlation near zero and a $\chi^2$ p-value that is not small tell us the helper is calibrated correctly on a known-independent pair. We will reuse this helper in the next three sections to test Basu's theorem on three different models.
Try it: Feed the helper a clearly dependent pair (e.g., $T = Z$ and $V = Z^2$ for $Z \sim N(0,1)$). Does the helper flag the dependence?
Click to reveal solution
Explanation: Correlation alone would have missed the dependence because $Z$ and $Z^2$ are uncorrelated yet perfectly dependent. The $\chi^2$ check on binned quantiles catches this non-linear structure and fires a near-zero p-value.
How do we verify sample mean and variance are independent under a normal model?
The textbook Basu example is also the most useful in practice. For $X_1, \ldots, X_n$ iid $N(\mu, \sigma^2)$ with $\sigma$ known, the sample mean $\bar{X}$ is complete and sufficient for $\mu$. The sample variance $S^2$ is ancillary for $\mu$, because shifting every $X_i$ by a constant leaves $S^2$ unchanged. Basu's theorem then gives us the independence of $\bar{X}$ and $S^2$ with no integrals.
Let us verify it by Monte Carlo.
A correlation of $0.009$ and a $\chi^2$ p-value near $0.42$ are exactly what Basu's theorem predicts. Under the normal model, $\bar{X}$ and $S^2$ are statistically independent, not merely uncorrelated. A scatter makes the independence visible.
The cloud has no visible trend, no fanning, and no curvature. If $\bar{X}$ and $S^2$ were dependent, the conditional variance of $S^2$ at the extremes of $\bar{X}$ would be different from its variance in the middle, and the cloud would bulge or pinch. It does not.
Try it: Re-run the Monte Carlo for $\mu = 10$ and $\mu = -5$. The correlation should still be close to zero, confirming that independence holds for every value of $\mu$.
Click to reveal solution
Explanation: The theorem claims independence for every $\mu$, and the Monte Carlo at $\mu = 10$ and $\mu = -5$ both confirm it.
How does Basu's theorem apply to uniform and exponential distributions?
The normal is famous but far from the only model where Basu's theorem pays off. Two more canonical examples round out the picture.
First, the uniform on $(0, \theta)$. Here $X_{(n)}$, the sample maximum, is complete sufficient for $\theta$. The ratio $\bar{X} / X_{(n)}$ is ancillary because both numerator and denominator scale with $\theta$, and the ratio cancels it.
The correlation is tiny and the $\chi^2$ test does not reject. The sample maximum tells you nothing about the mean-to-max ratio, just as Basu's theorem predicts.
Second, the exponential with rate parameter $\beta$. Here $\sum X_i$ is complete sufficient, and $X_1 / \sum X_i$ is ancillary because the $\beta$-scaling drops out of any ratio of coordinates of the sample.
Again the helper reports no evidence against independence. In both cases, the general pattern is the same: find a ratio that cancels the scale parameter, and you have found an ancillary statistic.
Try it: For iid $\text{Exp}(\beta)$, is the ratio $X_1 / X_2$ ancillary? Simulate and check with is_independent() against the total $\sum X_i$.
Click to reveal solution
Explanation: $X_1 / X_2$ is the ratio of two iid exponentials, which has a distribution that is free of $\beta$ (it is $F_{2,2}$-distributed with some rescaling). So the ratio is ancillary, and by Basu it must be independent of the complete sufficient $\sum X_i$.
Practice Exercises
Exercise 1: Verify $S^2$ is ancillary for $\mu$
Simulate $N(\mu, 1)$ samples of size $n = 50$ for $\mu = 0$ and $\mu = 5$, with $3000$ replicates each. Compute the empirical mean and sd of $S^2$ in both cases. Save the two summary vectors as my_s2_mu0 and my_s2_mu5.
Click to reveal solution
Explanation: The two rows agree within Monte Carlo error, confirming $S^2$ is ancillary for $\mu$.
Exercise 2: Use Basu's theorem to compute $E[X_1 / \sum X_i]$
For iid $X_i \sim \text{Exp}(\beta)$ with $n = 5$, show analytically that $E[X_1 / S] = 1/n$ where $S = \sum X_i$, using Basu's theorem. Then verify by simulation with $\beta = 2$.
Analytical hint: $X_1 / S$ is ancillary and $S$ is complete sufficient, so they are independent. Therefore $$E[X_1] = E\!\left[ \frac{X_1}{S} \cdot S \right] = E\!\left[ \frac{X_1}{S} \right] \cdot E[S].$$ Substitute $E[X_1] = 1/\beta$ and $E[S] = n/\beta$ and solve.
Click to reveal solution
Explanation: The analytical answer is $1/n = 1/5 = 0.2$. The decomposition uses independence of $X_1/S$ and $S$, which is exactly Basu's theorem. No direct integration was required.
Exercise 3: Is the range ancillary under $U(0, \theta)$?
For iid $U(0, \theta)$, the range $R = X_{(n)} - X_{(1)}$ is not ancillary for $\theta$ (in contrast to the $U(\mu, \mu+1)$ case). Simulate $4000$ samples of size $n = 20$ at $\theta = 1$ and at $\theta = 3$. Compare the mean and sd of the range. Explain the result in one sentence.
Click to reveal solution
Explanation: The mean and sd of the range at $\theta = 3$ are roughly three times those at $\theta = 1$. The distribution of the range is $\theta$-scaled, so it is not ancillary for $\theta$. The ancillary statistic in this scale family is a ratio that cancels $\theta$, not the range itself.
Complete Example
Let us bundle everything into one verification script: Basu's theorem across three canonical models in a single sweep.
All three rows come back as PASS, and the correlations cluster near zero as theory demands. With a single R script we have verified Basu's theorem across three textbook cases and built a reusable pattern for any future model: find the complete sufficient statistic, find an ancillary ratio, and run the independence helper.
Summary
A one-page takeaway of everything we covered.
- Ancillary: distribution does not depend on $\theta$. It lives orthogonal to the parameter.
- Sufficient: condenses all $\theta$-information from the sample into a single statistic (or vector).
- Complete sufficient: sufficient, and no non-zero function of the statistic has mean zero for every $\theta$.
- Basu's theorem: complete sufficient and ancillary statistics are independent, for every $\theta$, with no further calculation required.
| Model | Complete sufficient $T$ | Ancillary $V$ | Basu says |
|---|---|---|---|
| $N(\mu, \sigma^2)$, $\sigma$ known | $\bar{X}$ | $S^2$ | $\bar{X} \perp S^2$ |
| $U(\mu, \mu+1)$ | order statistic | range $R$ | $T \perp R$ |
| $U(0, \theta)$ | $X_{(n)}$ | $\bar{X} / X_{(n)}$ | $X_{(n)} \perp \bar{X}/X_{(n)}$ |
| $\text{Exp}(\beta)$ | $\sum X_i$ | $X_1 / \sum X_i$ | $\sum X_i \perp X_1/\sum X_i$ |
The practical payoff: whenever you need independence of two statistics under a parametric model, check whether one is complete sufficient and the other is ancillary. If yes, Basu's theorem gives you the result in one line.
References
- Basu, D. (1955). On statistics independent of a complete sufficient statistic. Sankhyā 15: 377-380. [Original paper]
- Lehmann, E. L. (1981). An interpretation of completeness and Basu's theorem. JASA 76(374): 335-340. Link
- Casella, G. & Berger, R. L. (2002). Statistical Inference, 2nd Edition. Duxbury. Chapter 6: Principles of Data Reduction.
- Wikipedia contributors. Basu's theorem. Link
- Mackey, L. (2015). STATS 300A Theory of Statistics, Lecture 4: Completeness and Ancillarity. Stanford University. Link
- Berkeley Statistics (2024). Stat210A Reader: Completeness, Ancillarity, and Basu's Theorem. Link
- Ghosh, M. (2002). Basu's theorem with applications: a personalistic review. Sankhyā A, 64(3, Part 1): 509-531.
- Watkins, J. (n.d.). F4: Completeness (lecture notes). University of Arizona. Link
Continue Learning
- Point Estimation in R: What Makes an Estimator Good?: bias, variance, and MSE of estimators; the context in which complete sufficient statistics pay off.
- Sufficiency in Statistics: Sufficient Statistics and the Fisher-Neyman Factorization: how to recognize and construct sufficient statistics; prerequisite context for Basu's theorem.
- Maximum Likelihood Estimation in R: the estimation method that most often produces complete sufficient statistics in practice.