Tutorials › Introduction to Statistics › Means, Spread, and Quantiles of a Uniform Model

Poisson and Other Count Models · Tutorial 441 of 996

Means, Spread, and Quantiles of a Uniform Model

Learn to summarize a continuous uniform model, calculate its quantiles, and assess whether its constant-density assumption is reasonable.

Intermediate 10 min read

What You'll Learn

  • Identify the support and constant-density assumption of a continuous uniform model.
  • Derive and interpret its mean, variance, and standard deviation.
  • Calculate percentiles and other quantiles from the model.
  • Find probabilities by comparing interval lengths.
  • Assess uniformity using the setting, support, and patterns in observed data.

Why Summaries Matter for a Uniform Model

A continuous uniform model says that values are spread evenly across a specified interval. This makes many calculations straightforward: probabilities depend on interval lengths, and the model's center and spread can be derived directly from its endpoints. But a convenient formula is useful only when the assumption of equal likelihood is reasonable for the quantity being modeled.

Here we develop the model's mean, variance, standard deviation, and quantiles, and use examples to see what these summaries say. These are properties of the proposed probability model; they are not automatically the same as summaries calculated from a particular sample.

Definition: A continuous random variable \(X\) has a continuous uniform distribution on \([a,b]\), written \(X\sim\operatorname{Unif}(a,b)\), when \(a<b\) and its probability density is constant at \(1/(b-a)\) between \(a\) and \(b\), and zero outside that interval. The interval \([a,b]\) is the model's support. Thus, for \(a\leq x\leq b\), the density is \(f(x)=1/(b-a)\). A density is not itself a probability at a point; probabilities are areas under the density.

For any interval \([c,d]\) lying within the support, its probability is its length divided by the full support length:

$$ P(c\leq X\leq d)=\int_c^d \frac{1}{b-a}\,dx=\frac{d-c}{b-a}. $$

The same length rule applies when an interval includes or excludes either endpoint, because any single point has probability zero in a continuous model. In particular, \(P(X=a)=P(X=b)=0\), even though \(a\) and \(b\) bound the support.

Mean, Variance, and Standard Deviation

The mean \(E(X)\) is the model's long-run average value. The variance \(\operatorname{Var}(X)\) is the expected squared distance from that mean, and the standard deviation is the square root of the variance. For a uniform model, the mean is halfway between the endpoints. The standard deviation depends on the interval's width, not on where the interval is located.

Theorem: If \(X\sim\operatorname{Unif}(a,b)\), then $$ E(X)=\frac{a+b}{2},\qquad \operatorname{Var}(X)=\frac{(b-a)^2}{12},\qquad \operatorname{SD}(X)=\frac{b-a}{\sqrt{12}}. $$ The mean and standard deviation have the same units as \(X\); the variance has squared units.

The formulas follow from the definition of expectation for a continuous random variable. The density is constant over the support, so the mean is the average of \(x\) weighted by that density:

$$ E(X)=\int_a^b x f(x)\,dx =\frac{1}{b-a}\int_a^b x\,dx =\frac{1}{b-a}\left[\frac{x^2}{2}\right]_a^b =\frac{a+b}{2}. $$

To find the variance, write \(L=b-a\) for the support width and \(m=(a+b)/2\) for the mean. The variance is the average squared distance from \(m\), weighted by the density. Changing the integration variable to the distance \(u=x-m\) makes the endpoints \(-L/2\) and \(L/2\):

$$ \begin{aligned} \operatorname{Var}(X) &=\frac{1}{L}\int_a^b (x-m)^2\,dx\\ &=\frac{1}{L}\int_{-L/2}^{L/2}u^2\,du\\ &=\frac{1}{L}\left[\frac{u^3}{3}\right]_{-L/2}^{L/2}\\ &=\frac{1}{L}\left(\frac{L^3}{24}-\left(-\frac{L^3}{24}\right)\right) =\frac{L^2}{12}. \end{aligned} $$

Taking the positive square root gives \(\operatorname{SD}(X)=L/\sqrt{12}\). The derivation also explains the location-and-width distinction: shifting both endpoints changes \(m\), but leaves \(L\), and therefore the variance and standard deviation, unchanged.

Worked Example: Summarizing a Uniform Time Model

Suppose a hypothetical quality-control device records the time, in seconds, for a process whose duration is modeled as uniform from 4 to 10 seconds. In this model \(a=4\), \(b=10\), and the density is constant on that interval. The stated model assumes every equal-length subinterval of the support is equally likely; the calculations below are conditional on that assumption.

The mean is the midpoint:

$$ E(X)=\frac{4+10}{2}=7\text{ seconds}. $$

The variance and standard deviation are:

$$ \operatorname{Var}(X)=\frac{(10-4)^2}{12} =\frac{36}{12}=3.00\text{ seconds}^2, \qquad \operatorname{SD}(X)=\frac{6}{\sqrt{12}} \approx 1.732\text{ seconds}. $$

Thus, the model's long-run average duration is 7 seconds, and its standard deviation is about 1.732 seconds. The variance is 3.00 seconds squared, not 3.00 seconds; the standard deviation returns the spread to the original time units.

Quantiles of a Uniform Distribution

A \(p\)-quantile is a value \(q_p\) such that the cumulative probability at or below it is \(p\). For a continuous uniform distribution and \(0\leq p\leq 1\), the cumulative distribution function within the support is the accumulated area from \(a\) to \(x\):

$$ F(x)=P(X\leq x)=\frac{x-a}{b-a},\qquad a\leq x\leq b. $$

To find the \(p\)-quantile, set \(F(q_p)=p\) and solve for \(q_p\). This gives a direct formula:

Result: For \(X\sim\operatorname{Unif}(a,b)\), the \(p\)-quantile is $$ q_p=a+p(b-a),\qquad 0\leq p\leq 1. $$ For example, the median is \(q_{0.5}=(a+b)/2\), and the 25th and 75th percentiles are one-quarter and three-quarters of the way across the support.

Worked Example: Finding Percentile Cutoffs

A hypothetical machine selects a setting modeled as uniform between 12 and 20 units. Find the 10th percentile, the median, and the 90th percentile, including the units.

Here \(a=12\), \(b=20\), and the support width is \(20-12=8\) units. Use \(q_p=a+p(b-a)\).

$$ q_{0.10}=12+0.10(8)=12.8\text{ units}, $$
$$ q_{0.50}=12+0.50(8)=16\text{ units}, \qquad q_{0.90}=12+0.90(8)=19.2\text{ units}. $$

Under the model, 10% of settings fall at or below 12.8 units, half fall at or below 16 units, and 90% fall at or below 19.2 units. These are model-based probability statements, not guarantees about the exact percentages in a finite set of settings.

Using Lengths to Calculate Probabilities

Quantiles can be used in reverse to identify cutoffs for a desired fraction of the model's probability. The length rule is also a quick way to check the answer: for example, a subinterval occupying one-quarter of the support has probability one-quarter. If an interval extends beyond the support, only its overlap with \([a,b]\) contributes probability.

Worked Example: Probability Between Two Cutoffs

Suppose a hypothetical sensor's error \(X\), in millimeters, follows a uniform model from \(-2\) to \(6\). Find the probability that its error lies between 0 and 3 millimeters, and find the 80th percentile.

The full support has length \(6-(-2)=8\) millimeters. The interval from 0 to 3 has length \(3-0=3\) millimeters, so its probability is:

$$ P(0\leq X\leq 3)=\frac{3}{8}=0.375. $$

The probability is 0.375, or 37.5%. For the 80th percentile, use the same support width in the quantile formula:

$$ q_{0.80}=-2+0.80\bigl(6-(-2)\bigr) =-2+0.80(8)=4.4\text{ mm}. $$

Thus, 80% of the modeled errors are at or below 4.4 mm. Both answers depend on the assumption that the error is uniformly distributed throughout the stated interval.

Is Equal Likelihood Plausible?

A uniform model is plausible when the values are confined to a meaningful interval and there is a good reason to expect a roughly constant density within it. A mechanism might select a value at random from a range, or a physical process might make any equal-width portion of a range about as likely as any other. The model should also put its support in the right place: observations outside \([a,b]\) cannot occur under it.

Observed data can provide a rough check. Divide the support into equal-width bins and compare the counts. If the observations are independent draws from a uniform model, each such bin has the same probability, so the expected counts are equal. Sample counts will not be exactly equal even when the model is correct. Small fluctuations are ordinary; a strong pattern, such as counts steadily increasing across bins, suggests that equal likelihood may be a poor description. A visual pattern is a diagnostic, not by itself a formal proof or a complete statistical test.

Worked Example: Checking a Uniformity Assumption

A hypothetical analyst records 100 independent measurements, each between 0 and 10 units, and sorts them into five equal-width bins. The counts are 15, 18, 23, 21, and 23. Assess whether a uniform model is a plausible description.

If the measurements follow a uniform model on \([0,10]\), each bin has width \(10/5=2\) units and probability \(2/10=0.20\). For 100 independent measurements, the expected count in each bin is therefore:

$$ 100(0.20)=20. $$

The observed counts range from 15 to 23, and they fluctuate around 20 without a clear steady increase or decrease. This pattern is not an obvious contradiction of equal likelihood, so a uniform model is a plausible first description in this example. It is not established as true: finer bins, other relevant information, or more data could reveal structure not visible here.

Common Mistakes and Practical Checks

The formulas are simple, but their interpretation still requires care. Before calculating, verify that the model specifies a continuous quantity, identify the support endpoints, and check that the interval is being treated as equally likely per unit of length. Then distinguish a model summary from a sample summary.

  • Confusing variance and standard deviation. Variance is in squared units; standard deviation is in the original units. For an interval of width 8 seconds, the variance is \(64/12\) seconds squared, while the standard deviation is \(8/\sqrt{12}\) seconds.
  • Assuming a flat density means every exact value has positive probability. In a continuous model, the probability of any one exact value is zero. Equal density means equal-length intervals have equal probability.
  • Using endpoints without checking the assumption. Knowing that values range from \(a\) to \(b\) does not show that values in the middle are just as likely as values near the endpoints. The setting and observed pattern matter.
  • Treating a model percentile as a fixed sample percentage. A \(p\)-quantile has cumulative model probability \(p\); it does not guarantee that exactly \(p\) of a finite sample will fall below the cutoff.
  • Using the wrong support width. The formulas use \(b-a\), not \(b\) alone. This matters especially when \(a\) is negative.
Key takeaway: For \(X\sim\operatorname{Unif}(a,b)\), the mean is the midpoint, the variance is the squared width divided by 12, and the \(p\)-quantile is \(a+p(b-a)\). These results describe the model only when its support and equal-likelihood assumption are defensible.

Check Your Understanding

Use the formulas and interpretations developed above.

  1. For \(X\sim\operatorname{Unif}(2,14)\), find the mean, variance, and standard deviation. Include the appropriate units if \(X\) is measured in minutes.
  2. For the same model, find the 25th percentile and the median.
  3. A uniform model has support from \(-5\) to 5. What is the probability that \(X\) lies between \(-1\) and 2?
  4. Explain why an exact value such as \(X=4\) has probability zero even though the density is positive at 4.
  5. Five equal-width bins have observed counts 8, 9, 11, 12, and 10. Under a uniform model, what count would be expected in each bin if there were 50 independent observations, and what would you check before judging the model?