# Distribution of a spread of observations in triplicate sample taken from Gaussian distribution

Suppose random triplicate samples are taken from a Gaussian distribution with known mean and SD. What should be the distribution of the maximum absolute difference between 3 possible pairs of observations within each sample (the range of a triplicate)?

• I don't believe the pdf or cdf has a closed-form but both can be easily approximated with numerical integration.
– JimB
Commented May 17 at 14:10
• The difference of iid Gaussian RVs is Gaussian, and the absolute value follows a folded normal distribution - since there are 3 possible nonzero pairwise differences, try working out the distribution of the max order statistic of three folded Gaussians Commented May 17 at 18:35
• @RandySavage I assume you mean three non-independent folded Gaussians. That would seem much more complicated than necessary.
– JimB
Commented May 17 at 20:22
• @JimB, Other than Monte Carlo, is there a simpler way to estimate how scattered the triplicate samples should be if they are uncontaminated and were taken from a Gaussian parent distribution with known variance. In other words, how far an observation in the triplicate should be from eg. the mean of the other, closer pair to suspect contamination/outlier? I suspect that the natural spread in v. small samples may be greater than the intuition suggests even if the observations are well-behaved... Commented May 20 at 6:23
• You need to specify what you want in standard statistical lingo devoid of whatever one's current "intuition" happens to be. You now have introduced "contamination", "mean of the other, closer pair", and "natural spread" that you haven't defined. Describing the practical/subject matter aspects of why you want the distribution of the range of 3 independent identically distributed normals would be helpful.
– JimB
Commented May 20 at 12:36

If the question is about finding the distribution of the range of sample of 3 independent observations from a common normal distribution with known mean and variance, then numerical integration will give that to you. What you want to do with that distribution needs more clarification from you.

Suppose we have independent random variables $$X_1$$, $$X_2$$, and $$X_3$$ from a normal distribution with mean 0 and variance 1. The joint density of the minimum ($$X_{(1)}$$) and the maximum ($$X_{(3)}$$) is given by

$$\frac{3 e^{-\frac{x_{(1)}^2}{2}-\frac{x_{(3)}^2}{2}} (\Phi (x_{(3)})-\Phi (x_{(1)}))}{\pi }$$

where $$\Phi$$ is the standard normal cumulative distribution function (cdf). The probability density function (pdf) of the range ($$X_{(3)}-X_{(1)}$$) is given by

$$\int_{-\infty }^{\infty } \frac{3 e^{-\frac{x_{(1)}^2}{2}-\frac{1}{2} (x_{(1)}+z)^2} (\Phi (x_{(1)}+z)-\Phi (x_{(1)}))}{\pi } \, dx_{(1)}$$

There is no nice closed-form for this pdf but numerical integration works fine. Here I've used Mathematica but this can be also coded in R. (Let me know if coding this in R is necessary.)

Φ[z_] := 1 - (1 - Erf[z/Sqrt[2]])/2
Plot[NIntegrate[(3 E^(-(x1^2/2) - (z + x1)^2/2)  (-Φ[x1] + Φ[z + x1]))/π, {x1, -∞, ∞}], {z, 0, 6},
Frame -> True, PlotRange -> {All, {0, 0.5}}, PlotRangePadding -> None,
FrameLabel -> {"Range", "PDF"}]


Finding the cdf is just one more level of numerical integration:

Plot[NIntegrate[(3 E^(-(x^2/2) - (z + x)^2/2)  (-Φ[x] + Φ[z + x]))/π, {x, -∞, ∞}], {z, 0, 6},
FrameLabel -> {"Range", "CDF"}]


To obtain a table of cdf values:

TableForm[
Table[{z0, NIntegrate[(3  E^(-(x^2/2) - (z + x)^2/2)   (-Φ[ x] + Φ[z + x]))/π, {x, -∞, ∞}, {z, 0, z0}]},
{z0, 0, 6, 0.25}], TableHeadings -> {None, {"Range", "CDF"}}]


A denser set of values can be obtained by changing the 0.25 to a much smaller value.

• Thank you! Would it be difficult to extract numerical quantiles from it using Mathematica? And I have a question, which will probably infuriate purists: I do understand that this distribution probably has no close-form solution, but... could some other common distributions (like Beta with some parameters or maybe some others) approximate this distribution (ie. be fitted to it 'well enough' throughout the most of the range) to do away with the need for integration to derive reasonable, approximate quantiles from it? Commented May 20 at 18:16
• Not difficult at all. Essentially the Plot function is replaced with a Table function. I'll add that later today. Nothing wrong with using an approximating distribution but that really requires you to be more specific as to what "well enough" means. For example, are you only interested in the upper tail region and if so, how close do you want the approximation to be?
– JimB
Commented May 20 at 18:46
• In practice, it is indeed probably more meaningful to fit 'well enough' the upper tail as too high of a range in the triplicate sample may be indicative of the sample being 'odd' and serve as a potential warning that it's been unlikely been drawn from the assumed Gaussian distribution. It doesn't have to be very close - but the fatness of the tail may matter - it's about not being alarmed if it is likely that the triplicate sample is spread so much and being warned that something may not have gone as planned if more. I'd think that being within a few % of the actual CDF (at the tail) is good. Commented May 20 at 19:23
• That being said, it may also be 'odd' if the observations in the triplicate sample are all the same all of a sudden, but that's usually less of a problem. Commented May 20 at 19:27
• Perhaps Chi-squared or F distributions, or even Log-normal could also be candidates for a reasonable approximation? Commented May 20 at 19:56