# Talk:Uniform distribution (continuous)

WikiProject Mathematics (Rated B-class, Mid-priority)
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
 B Class
 Mid Priority
Field: Probability and statistics
WikiProject Statistics (Rated B-class, High-importance)

This article is within the scope of the WikiProject Statistics, a collaborative effort to improve the coverage of statistics on Wikipedia. If you would like to participate, please visit the project page or join the discussion.

B  This article has been rated as B-Class on the quality scale.
High  This article has been rated as High-importance on the importance scale.

## Changed definition

I changed the definition for the continuous case so that F(F(U(x))=U(x) where U(x) is the uniform distribution and F is the continuous Fourier transform. If this change survives, I will alter the graph of the uniform distribution to reflect the change, something along the lines of the graph in the rectangular function. I'm trying to eventually bring the boxcar function, the rectangular function, and the uniform distribution into coherence. Paul Reiser 19:27, 19 Feb 2005 (UTC)

And now I've changed it to make it clear that although that view may be more-or-less harmless, it must not be considered obligatory. Michael Hardy 01:32, 20 Feb 2005 (UTC)

Hi Michael - Would you have an objection to making the definition for the uniform distribuiton to be 1/2 at the transition points and making it clear that its not obligatory? The advantages that I see are:

• It will be consistent with the Heaviside step and rectangle function articles where the transitions are set to 1/2. We don't want to alter these, I think, because then the statement that the Fourier transform of the Sinc function is the rectangle function has to be modified by adding "except at the transition points". This would hold true also for any function built up with the Heaviside function.
• Assuming the Heaviside stays the same, we won't need to modify the definition of the uniform distribution in terms of the Heaviside step function by adding "except at the transition points". Paul Reiser 04:22, 20 Feb 2005 (UTC)

I've added an explanation to go along with the mid-point definition. This also has the advantage that we can keep the definition of the Heaviside step function in terms of the sign function which is unambiguously defined at the transition point. Now we can use "equals" when defining the uniform distribution in terms of either the Heaviside or the sign functions. 69.143.60.69 01:21, 23 Feb 2005 (UTC)

PS - Above user is me, Paul Reiser (not logged in due to disk crash)

I have no objection to mentioning that that convention is convenient in certain contexts, but I don't want to see it made conspicuous in the tables and such, because a different convention is appropriate in a different context, and also it may erroneously appear to be very important to adopt a certain convention at the boundaries. Michael Hardy 01:58, 7 Apr 2005 (UTC)

Whatever definition we choose will be conspicuous. Do you have an idea about how to stress more strongly that, in the probability distribution context, the values at the transition points are not important? PAR 03:17, 7 Apr 2005 (UTC)

Michael - I saw your changes, and made a few more. We have to enter the same kind of rewording in the Heaviside and rectangle function articles as well. PAR 03:37, 7 Apr 2005 (UTC)

Please provide labels and units for the axis of all plots whether or not they are obvious. — Preceding unsigned comment added by 183.89.32.135 (talk) 05:24, 28 December 2011 (UTC)

## PDF

So why does the PDF defined like a heaviside step function? The probability of a point is zero, so defining it at exactly a and b is irrelevant since p(a) = p(b) = 0. Cburnett 05:37, Apr 6, 2005 (UTC)

I forgot to move the discussion page from the old uniform distribution to here. I inserted it above, and I hope it explains that. PAR 21:56, 6 Apr 2005 (UTC)

## Math error in the graph

I am not able to edit the picture. It has ab where clearly ba is needed. Also the stubby little hyphen it uses for a minus sign, with no spacing, is nearly illegible. And the half-way points on the vertical line are obnoxious. At best they're unnecessary, and when applied to maximum likelihood problems, they are very misleading. Michael Hardy 02:28, 25 Apr 2005 (UTC)

Hi Michael - I fixed the a-b error in the graph, thanks for pointing that out. As for the half-way points, they are not absolutely obnoxious, they are only relatively obnoxious to someone used to dealing with maximum likelihood problems. To someone used to dealing with Fourier analysis and closure under L2 integration, any other representation is relatively obnoxious. We've gone over this before (see above), but I'm willing to change the picture to whatever consensus we can arrive at. PAR 03:01, 25 Apr 2005 (UTC)
Paul, I think I understand where you are coming from, but I have to say that in my limited experience everyone in statistics defines the uniform distribution over an open interal $(a;b)$, with zero mass allocated to the points $a$ and $b$. I'm willing to bet that this is the most common definition one will find in statistics textbooks, and it has the advantage of being straightforward and not requiring much explanation. This is what I would suggest we use for the infobox, both the plots and the formulas. It's of course Ok to discuss alternative definitions in the body of the article, but let's keep the infoboxes as simple as possible – they are terse enough to begin with, and anything that might strike readers as unusual is better discussed in the article itself. I would suggest you keep the current plots but move them out of the infobox and integrate them into the discussion of the alternative definition. --MarkSweep 06:58, 25 Apr 2005 (UTC)
As I pointed out in the previous section, the probability of any point is zero so defining them, in terms of probability, is pointless (haha, pun intended). I also think it should be an open or closed (again, it doesn't matter) interval but not half-valued-endpoints like heaviside step. Cburnett 19:51, Apr 25, 2005 (UTC)

Ok, I will change it soon, to be 1/(b-a) at the transition points, but this will have ripple effects. We want the following articles to be consistent:

• The Heaviside step function article - what is the definition at the transition point? - if other than 1/2, then its no longer definable in terms of sgn function without disclaimer
• The Rectangular function article - what is the definition at the transition point? - if other than 1/2, then its no longer definable in terms of sgn function without disclaimer
• The Sinc function article (?)

Please let me know your thoughts on these as well. Although I work with them, I have never tracked down the "correct" definitions. Also, any help fixing these articles would be appreciated. PAR 21:12, 25 Apr 2005 (UTC)

I think all those other ones can stay as they are. The uniform distribution article is specifically about probability and P(a) = P(b) = 0. I guess I don't see the necessity of keeping functions synchronized with a probability distribution. Though I think noting that the Heaviside half-value convention can be used with the uniform distribution if it's necessary/helpful precisely because P(a) = P(b) = 0. Cburnett 22:56, Apr 25, 2005 (UTC)

I fixed the plot so that P(a)=P(b_=1/(a-b). I was looking at "what links here" for the uniform article, and the beta distribution gave as a limiting case the uniform distribution which had this behavior. I can change it either way without a lot of bother, but we should settle on zero or 1/(a-b) for the transition points and make all other articles consistent. What do we want for the transition points? PAR 06:05, 26 Apr 2005 (UTC)

I don't see why you need to mark the end points at all on the pdf graph. Having the mid points would be ugly, and in fact the decision is arbitrary, as the article notes. What is wrong with solid horizontal line segments joined by dashed vertical line segments? --Henrygb 23:21, 18 May 2005 (UTC)

Because then somebody would complain that the value at the transition point was vague, and wouldn't it be best to pick one and go with it. Sorry for the flip answer, but its probably true, and I tend to agree. Please read this whole page, and you'll see we have been discussing this at length. PAR 00:58, 19 May 2005 (UTC)

## Standard Uniform

I've commented out the "standard uniform" section because I can't make sense of it. I assume that the writer is trying to say something about random variates uniformly distributed, but the difference of two variates uniformly distributed between 0 and 1 is not a uniform distribution between 0 and 1. Maybe it should be uniform between -1 and 1? PAR 21:31, 26 Apr 2005 (UTC)

I uncommented the definition since that's correct for sure. As for the property, you're right. I was heading in the right direction but missed it. If $U_1 \sim UNIFORM(0,1)$ and $U_2 = 1 - U_1$ then $U_2 \sim UNIFORM(0,1)$. I think this holds if you replace "1" with "b". Right? Cburnett 21:51, Apr 26, 2005 (UTC)

Yes - I'll put that in. I'll use (0,1) since its in the standard section. PAR 23:14, 26 Apr 2005 (UTC)

To point out a problem - assume $X \sim UNIFORM(0,1)$ - then according to the rofmula for Variance(X) we get that it is equal to 1/12 while it`s actually 1/4. The same for any other example you might try (this was just the simplest i could find). The correct formula then is $\frac{(b-a+1)^2 -1}{12}$ , even though WolframAlpha is saying diffenrent. 89.138.142.119 (talk) 21:38, 12 January 2010 (UTC)

The variance of standard uniform is 1/12, no idea where'd you get the 1/4 number. It's an integral ∫(x-½)²dx. Also if you replace "1" with "b", then u2 = b − u1 will be distributed U(b−1,b), which is not standard uniform unless b = 1.  … stpasha »  10:56, 13 January 2010 (UTC)

## Uniformity Test

In the article Normal distribution, there is a section named Normal_distribution#Normality_tests, and we also have an article Normality_test. The uniform distribution is more fundamental. Is there any test for the uniform distribution? QQ plot can be used, but not formal enough.

The problem is real. I have some data, I know it is uniformly distributed. However, I don't know how to formally test my hypothesis. When I came to check wiki, I didn't find any. Jackzhp (talk) 01:18, 23 February 2009 (UTC)

## Sum of two Uniform distribution (continuous)

I added the line The sum of two indepedent, equally distributed, uniform distributions yields a symmetric triangular distribution but I'm not comfortable with it. The problem is that it generalizes, but not much, as there is no indication about the sum of two independent _generic_ uniform continuous distributions - whose pdf would be a piecewise linear function. Albmont (talk) 16:16, 1 July 2009 (UTC)

## Possible discussion of "Even" distribution

I'm wondering if there is any rigorous work out there to help clarify the intuitive concept of an "even" distribution. It seems related to uniformity, but more demanding of the absence of apparent non-uniformity within smaller sample sizes. My interest here is more for the purpose of software and pseudo-random distributions, but there is probably a theoretical backdrop here. Being not an expert myself, I just don't know what that might cover. Here are some thoughts on the topic, which should soon be deleted, but surely there is a more clear definition in a mathematical work somewhere?

When randomly selecting from N discrete items or values from a finite set, a perfectly even distribution would pick each possibility exactly once over N selections. The more "even" a distribution, the more likely that each selection will be spread out from prior selections.

This is not true of uniform distribution, where each sample (selection) is independent of the others. Pseudo-random generators attempts to mimic complete independence of every selection from the history of selections already having occurred. Thus it is possible for the same item to be selected multiple times in a row.

Pseudo-random number generators often go to great lengths to ensure the appearance of true randomness, but often what one really wants is an even distribution instead. If there are N items to choose from, you would want each item to be chosen about one time before it is chosen again, with perhaps a small possibility of deviation, where perhaps a few (say N/100) might actually be chosen three times, a few more (say N/10) are chosen twice, and a few might not be chosen at all on that sequence of N selections. Achieving an exact evenness is trivially achieved by storing all possible selections in an array, with the remaining I iterations of unchosen items being kept in I contiguous elements of that array. Each selection chooses one item from within that contiguous range using a uniform random distribution, delivers it, and then swaps it with the position at either boundary before moving that boundary inward. Usually the range is from index 0 up to I-1, where I moves from N down to 0 (as per Knuth's algorithms). This is essentially dealing from a deck of cards, returning all cards back to the deck after they are all dealt. On the other hand, if you don't want perfect evenness, but only an approximation thereunto that still retains randomness, there are many ways to achieve it, but they all require some sort of persistence. In other words, you have to keep data related to what has been selected so far or what is left to be selected, or both, up to some degree (say, N selections worth).

However, it is not truly necessary to keep all items in an array to achieve the "random deal" functionality. One of the simplest ways of generating pseudo-random sequences involves a mathematical calculation that keeps a seed value from the previous iteration, and it ultimately uses a modulo function to get a remainder from 0 up to that value, say M, minus 1. It also uses a fixed multiplier and offset at each iteration. With appropriately chosen values (typically relatively-prime), then over a sequence of M selections, every possible value that can be chosen will be chosen. When viewed from this perspective, that pseudo-random generator only has a resolution of 1/(M-1) when mapped to the range [0..1). The smaller that value is, the shorter the sequence that appears to achieve "even" distribution. If we write a custom pseudo-random generator that uses our intended value N as the modulus (M), then we can achieve a perfect even distribution quite readily. Thus we don't have to waste space storing the "deck of cards", but rely on modulo arithmetic to give us the desired result. But it is not very random, and the sequence will repeat without variation. So it might not provide the near-even-but-still-random distribution most often desired. By the way, that repetition and lack of randomness is one of the reasons uniform random number generators deviate from this simplest calculation method.

Things get even more complicated when you want more "evenness" in a distribution, but you need greater resolution. In other words, if you want real values of arbitrary precision, achieving even distribution can be a challenge. Of course, in that case, we would not want to keep track of every possible value. It doesn't take many bits of value resolution before that idea becomes absurd.

Straightforward approaches might combine a discrete and perfectly-even distribution (as described above) with uniformly-distributed offsets from those values. For example, if N=10, you randomly deal out values 0, 0.1, 0.2, ..., 0.9, and then add a uniform random value between 0 and 0.1 to each. You could also create more complex kernels of distribution around the discrete seed values, such as by summing (averaging, really) multiple uniformly random values to approximate normal-shaped kernels. But uniform variances are usually what is required to achieve the desired result -- simply use a higher value of N as needed. This same technique can be applied at recursively-finer levels of resolution, so that evenness is maintained at different levels of granularity.

Another possible approach is based on curve fitting techniques. Let's say we keep track of the last N selections, and we want the distribution to be fairly even across any N contiguous selections, yet still with some amount of randomness. One way to achieve it is to turn to arbitrary probability curves and use the transform from uniform distribution through the inverse of the cumulative form of a probability curve to achieve a random distribution that approximates that probability curve. This is a technique used in simulation and well described elsewhere. So if we let the target probability curve vary with each selection, we can let it represent something that looks like little bites have been taken out of an otherwise uniform (flat) probability where each of the prior N values occurred. In other words, if we have already returned 0.1 and 0.5 (assuming N=2), then values near to 0.2 are very unlikely, and so are values near to 0.5; but values closer to 0.8 for example might be relatively more likely. The bites might be considered "kernels" for curve-fitting purposes, and each one could be a narrow shape similar to a normal curve, whose significant width is something akin to 1/N (perhaps 3/N, for example), and the apex can cause the resulting probability curve to drop all the way to 0, or perhaps not that far, to achieve greater randomness. To reduce the impact of earlier selections as they get older, the bites that those earlier selections take out of the desired probability curve can be reduced in depth as they near the limit of N, according to some windowing function. The problem with this approach is that it can be difficult to ensure that the curve fitting still makes sense as you approach the outermost boundaries of the distribution (0 and 1, typically). A naive approach will result in greater probabilities near those extremes because fewer selections can occur near to them compared to selections nearer the middle of the distribution. The drawback of this technique is that both space and time requirements increase with N. As long as N is kept small, the technique can still be useful, however. It must be weighed against the relatively cheaper methods.

So that is the sort of thing I'm thinking, but since I have never read it anywhere, I cannot guess where to find it described more formally. Surely one of you who tracks this page will have an idea about that? I think it would be helpful to create a section here to contrast uniformity with evenness, if we can come up with formal definitions and tests. Any discussions about how to achieve it in software (as I've rambled about above) would probably have to go elsewhere, but I'm just trying to clarify the concept, for discussion on this talk page.

--Keith.blackwell (talk) 06:07, 5 May 2012 (UTC)

I think you may be after a low-discrepancy sequence. Not something i know much about myself though. Qwfp (talk) 15:16, 5 May 2012 (UTC)

## German tank problem

I believe the German tank problem has to do with the discrete uniform distribution, not the continuous uniform distribution. FilipeS (talk) 20:37, 27 January 2013 (UTC)

## The visual aspect of the intro

The intro of this article should be changed in order to meet Wikipedia standarts: the indentation of the text to left, so that it's no longer readable and the huge "illustrations" (i.e, pictures) besides should be changed. 46.19.85.63 (talk) 10:21, 17 July 2014 (UTC)

I've reduced the size of the images in the infobox; does that help? Qwfp (talk) 10:51, 17 July 2014 (UTC)