St · Statistics & Probability

How to Estimate Uniform Distribution Parameters by Moments

Updated 13 October 2026

At a glance

  1. 1. Specify the model

    Decide whether the interval endpoints are both unknown or one endpoint is known.

  2. 2. Write population moments

    Use the mean and, when needed, the second raw moment or variance of the uniform distribution.

  3. 3. Match sample moments

    Set the population moments equal to the corresponding sample moments and solve for the parameters.

  4. 4. Check the estimates

    Confirm the endpoint order and remember that moment estimates need not contain every observation.

The method of moments estimates distribution parameters by matching theoretical moments to moments calculated from the data. For a uniform distribution, the formula depends on which endpoint or endpoints are unknown. The common one-parameter model is uniform on [0,θ][0,\theta]; if both endpoints are unknown, you need two moments.

The estimates below use the ordinary method-of-moments convention: the kkth sample raw moment is n−1∑i=1nXikn^{-1}\sum_{i=1}^n X_i^k. This means the variance-like quantity in the two-parameter formula uses divisor nn, not n−1n-1.

If the distribution is uniform on [0,θ][0,\theta]

For X∼Uniform⁡(0,θ)X\sim\operatorname{Uniform}(0,\theta), the population mean is

E[X]=θ2.\mathbb{E}[X]=\frac{\theta}{2}.

The first sample raw moment is the sample mean, Xˉ=n−1∑i=1nXi\bar X=n^{-1}\sum_{i=1}^n X_i. Match it to the population mean and solve:

Xˉ=θ2⟹θ^MOM=2Xˉ.\bar X=\frac{\theta}{2} \quad\Longrightarrow\quad \hat\theta_{\mathrm{MOM}}=2\bar X.

For example, with observations 1,2,3,61, 2, 3, 6, the sample mean is 33, so the method-of-moments estimate is θ^=6\hat\theta=6. This estimate is not based on the largest observation; it comes from matching means. If the known lower endpoint is instead cc, so that X∼Uniform⁡(c,c+θ)X\sim\operatorname{Uniform}(c,c+\theta), then E[X]=c+θ/2\mathbb{E}[X]=c+\theta/2 and θ^=2(Xˉ−c)\hat\theta=2(\bar X-c).

If both endpoints are unknown

Suppose X∼Uniform⁡(a,b)X\sim\operatorname{Uniform}(a,b), with a<ba<b. Its first two raw moments are

E[X]=a+b2,E[X2]=a2+ab+b23.\mathbb{E}[X]=\frac{a+b}{2}, \qquad \mathbb{E}[X^2]=\frac{a^2+ab+b^2}{3}.

Define the first and second sample raw moments as

m1=Xˉ=1n∑i=1nXi,m2=1n∑i=1nXi2.m_1=\bar X=\frac{1}{n}\sum_{i=1}^n X_i, \qquad m_2=\frac{1}{n}\sum_{i=1}^n X_i^2.

The moment equations are m1=(a+b)/2m_1=(a+b)/2 and m2=(a2+ab+b2)/3m_2=(a^2+ab+b^2)/3. It is convenient to use the identity Var⁡(X)=E[X2]−E[X]2=(b−a)2/12\operatorname{Var}(X)=\mathbb{E}[X^2]-\mathbb{E}[X]^2=(b-a)^2/12. The corresponding sample moment difference is

m2−m12=1n∑i=1n(Xi−Xˉ)2.m_2-m_1^2=\frac{1}{n}\sum_{i=1}^n (X_i-\bar X)^2.

Thus the estimated midpoint is Xˉ\bar X, and the estimated width is 12(m2−m12)\sqrt{12(m_2-m_1^2)}. Solving for the endpoints gives

a^MOM=Xˉ−3(m2−Xˉ2),b^MOM=Xˉ+3(m2−Xˉ2).\hat a_{\mathrm{MOM}}=\bar X-\sqrt{3(m_2-\bar X^2)}, \qquad \hat b_{\mathrm{MOM}}=\bar X+\sqrt{3(m_2-\bar X^2)}.

Equivalently, if vn=n−1∑i=1n(Xi−Xˉ)2v_n=n^{-1}\sum_{i=1}^n(X_i-\bar X)^2, then a^=Xˉ−3vn\hat a=\bar X-\sqrt{3v_n} and b^=Xˉ+3vn\hat b=\bar X+\sqrt{3v_n}.

Worked example

Take the data 1,2,4,51,2,4,5. Their mean is Xˉ=3\bar X=3, and their second raw moment is

m2=12+22+42+524=11.5.m_2=\frac{1^2+2^2+4^2+5^2}{4}=11.5.

Therefore m2−Xˉ2=11.5−9=2.5m_2-\bar X^2=11.5-9=2.5. The estimated endpoints are

a^=3−7.5≈0.26,b^=3+7.5≈5.74.\hat a=3-\sqrt{7.5}\approx 0.26, \qquad \hat b=3+\sqrt{7.5}\approx 5.74.

The moment estimate is approximately Uniform⁡(0.26,5.74)\operatorname{Uniform}(0.26,5.74). If you are given the usual unbiased sample variance s2s^2 (with divisor n−1n-1), first convert it: vn=((n−1)/n)s2v_n=((n-1)/n)s^2. Do not substitute s2s^2 directly for vnv_n.

A symmetric uniform distribution

A different model is X∼Uniform⁡(−θ,θ)X\sim\operatorname{Uniform}(-\theta,\theta). Its mean is always zero, so the first moment cannot identify θ\theta. Use the second moment, E[X2]=θ2/3\mathbb{E}[X^2]=\theta^2/3, instead. Matching it to m2=n−1∑Xi2m_2=n^{-1}\sum X_i^2 gives θ^=3m2\hat\theta=\sqrt{3m_2}, with θ≥0\theta\geq 0.

Common mistakes

  • Assuming there is one formula for every uniform model. The answer changes depending on whether the interval is [0,θ][0,\theta], [c,c+θ][c,c+\theta], [−θ,θ][-\theta,\theta], or [a,b][a,b].
  • Using the sample maximum for the method of moments. The maximum is central to the maximum-likelihood estimate in some uniform models, but it is not the method-of-moments calculation. For [0,θ][0,\theta], the moment estimate is 2Xˉ2\bar X.
  • Using divisor n−1n-1 without adjustment. Standard sample raw moments use divisor nn. If starting from the unbiased sample variance, multiply it by (n−1)/n(n-1)/n before applying the two-endpoint formula.
  • Treating the result as a maximum-likelihood estimate. With two unknown endpoints, the moment estimates need not place every observation between the estimated endpoints. They are still the algebraic moment estimates, but a fitted uniform density with those endpoints would assign zero density to any observation outside the interval. Maximum likelihood instead uses the sample minimum and maximum (with parameter-space details depending on the convention).

If all observations are identical, the two-endpoint formulas give equal endpoints. This is a degenerate boundary case rather than a nonzero-width continuous uniform distribution.

References

  1. Mathematical Statistics with Applications — Dennis D. Wackerly, William Mendenhall III, and Richard L. Scheaffer
  2. Statistical Inference — George Casella and Roger L. Berger

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.