# Tag Info

## Hot answers tagged uniform

72

We can take various approaches to this, any of which may seem intuitive to some people and less than intuitive to others. To accommodate such variation, this answer surveys several such approaches, covering the major divisions of mathematical thought--analysis (the infinite and the infinitesimal), geometry/topology (spatial relationships), and algebra (...

61

TL;DR: The sharp contrast between the bits and coins is that in the case of the coins, you're ignoring the order of the outcomes. HHHHTTTT is treated as the same as TTTTHHHH (both have 4 heads and 4 tails). But in bits, you care about the order (because you have to give "weights" to the bit positions in order to get 256 outcomes), so 11110000 is different ...

60

Yes, there are many ways to produce a sequence of numbers that are more evenly distributed than random uniforms. In fact, there is a whole field dedicated to this question; it is the backbone of quasi-Monte Carlo (QMC). Below is a brief tour of the absolute basics. Measuring uniformity There are many ways to do this, but the most common way has a strong, ...

54

This is another illustration of Jensen's inequality $$\mathbb E[\log X] < \log \mathbb E[X]$$ (since the function $x\mapsto \log(x)$ is strictly concave] and of the more general (anti-)property that the expectation of the transform is not the transform of the expectation when the transform is not linear (plus a few exotic cases). (Most of my undergraduate ...

53

You may be looking for distribution known under the names of generalized normal (version 1), Subbotin distribution, or exponential power distribution. It is parametrized by location $\mu$, scale $\sigma$ and shape $\beta$ with pdf $$\frac{\beta}{2\sigma\Gamma(1/\beta)} \exp\left[-\left(\frac{|x-\mu|}{\sigma}\right)^{\beta}\right]$$ as you can notice, for ...

53

Consider two values symmetrically placed around $0.5$ - like $0.4$ and $0.6$ or $0.25$ and $0.75$. Their logs are not symmetric around $\log(0.5)$. $\log(0.5-\epsilon)$ is further from $\log(0.5)$ than $\log(0.5+\epsilon)$ is. So when you average them you get something less than $\log(0.5)$. Similarly, if you take a teeny interval around a collection of ...

39

Here are some general hints on solving this question: You have a sequence of continuous IID random variables which means they are exchangeable. What does this imply about the probability of getting a particular order for the first $n$ values? Based on this, what is the probability of getting an increasing order for the first $n$ values? It is possible to ...

36

No it is not uniform You can count the $36$ equally likely possibilities for the absolute differences second 1 2 3 4 5 6 first 1 0 1 2 3 4 5 2 1 0 1 2 3 4 3 2 1 0 1 2 3 4 3 2 1 0 1 2 5 4 3 2 1 0 1 6 5 ...

33

Let me start by denying the premise. Robert Geary probably didn't overstate the case when he said (in 1947) "...normality is a myth; there never was, and never will be, a normal distribution." -- the normal distribution is a model*, an approximation that is sometimes more-or-less useful. $\:$*(about which, see George Box, though I prefer the version on my ...

30

In the spirit of using simple algebraic calculations which are unrelated to computation of the Normal distribution, I would lean towards the following. They are ordered as I thought of them (and therefore needed to get more and more creative), but I have saved the best--and most surprising--to last. Reverse the Box-Mueller technique: from each pair of ...

26

It is not the case that exponentiating a uniform random variable gives an exponential, nor does taking the log of an exponential random variable yield a uniform. Let $U$ be uniform on $(0,1)$ and let $X=\exp(U)$. $F_X(x) = P(X \leq x) = P(\exp(U)\leq x) = P(U\leq \ln x) = \ln x\,,\quad 1<x<e$ So $f_x(x) = \frac{d}{dx} \ln x = \frac{1}{x}\,,\quad 1&... 24 It may be helpful to think of rectangles. Imagine you have the chance to get land for free. The size of the land will be determined by (a) one realization of the random variable or (b) two realizations of the same random variable. In the first case (a), the area will be a square with the side length being equal to the sampled value. In the second case (b), ... 23 I believe it means that the log is uniformly distributed, and the variable takes values in the range$[128, 4000]$. From a footnote of the paper: We will use the phrase drawn geometrically from A to B for 0 < A < B to mean drawing uniformly in the log domain between log(A) and log(B), exponentiating to get a number between A and B, and then ... 21 Using only the most basic axioms about probabilities and real numbers, one can prove a much stronger statement: The difference of any two independent, identically distributed nonconstant random values$X-Y$never has a discrete uniform distribution. (An analogous statement for continuous variables is proven at Uniform PDF of the difference of two r.v.) ... 20 Often it helps to use cumulative distribution functions. First, $$F(x) = \Pr((a-d)^2 \le x) = \Pr(|a-d| \le \sqrt{x}) = 1 - (1-\sqrt{x})^2 = 2\sqrt{x} - x.$$ Next, $$G(y) = \Pr(4 b c \le y) = \Pr(b c \le \frac{y}{4}) = \int_0^{y/4} dt + \int_{y/4}^1\frac{y\,dt}{4t} = \frac{y}{4}\left(1 - \log\left(\frac{y}{4}\right)\right).$$ Let$\delta$range between ... 20 The result that$p$values have a uniform distribution under$H_0$holds for continuously distributed test statistics - at least for point nulls, as you have here. As James Stanley mentions in comments the distribution of the test statistic is discrete, so that result doesn't apply. You may have no errors at all in your code (though I wouldn't display a ... 20 Assume$F_X$is continuous and increasing. Define$Z = F_X(X)$and note that$Z$takes values in$[0, 1]$. Then $$F_Z(x) = P(F_X(X) \leq x) = P(X \leq F_X^{-1}(x)) = F_X(F_X^{-1}(x)) = x.$$ On the other hand, if$U$is a uniform random variable that takes values in$[0, 1]$, $$F_U(x) = \int_R f_U(u)\,du =\int_0^x \,du =x.$$ Thus$F_Z(x) = F_U(x)$for ... 20 @StrongBad's comment is a really good suggestion. The sum of a uniform RV and gaussian RV can give you exactly what you're looking for if you pick the parameters right. And it actually has a reasonably nice closed form solution. The pdf of this variable is given by the expression: $$\dfrac{1}{4a}\left[\mathrm{erf}\left(\dfrac{x+a}{\sigma\sqrt{2}}\right)-\... 20 There is a famous saying by Gabriel Lippmann (physicist, Nobel laureate), as told by Poincaré: [The normal distribution] cannot be obtained by rigorous deductions. Several of its putative proofs are awful [...]. Nonetheless, everyone believes it, as M. Lippmann told me one day, because experimenters imagine it to be a mathematical theorem, while ... 19 With the information given by @Glen_b I could find the answer. Using the same notations as the question$$ P(Z_k \leq x) = \sum_{j=0}^{k+1} { k+1 \choose j } (-1)^j (1-jx)_+^k, $$where a_+ = a if a > 0 and 0 otherwise. I also give the expectation and the asymptotic convergence to the Gumbel (NB: not Beta) distribution$$ E(Z_k)= \frac{1}{k+1}\... 18 If you have not only the frequencies but the actual counts, you can use a$\chi^2$goodness-of-fit test for each data series. In particular, you wish to use the test for a discrete uniform distribution. This gives you a good test, which allows you to find out which data series are likely not to have been generated by a uniform distribution, but does not ... 18 Since the discussion grew long, I've taken my responses to an answer. But I've changed the order. Permutation tests are "exact", rather than asymptotic (compare with, for example, likelihood ratio tests). So, for example, you can do a test of means even without being able to compute the distribution of the difference in means under the null; you don't even ... 18 At heart this is not really just an R question; it relates to random number generation more generally. "Random" numbers are very important in many parts of statistics. We need the random values we generate to have certain properties, and (usually) a lot of effort goes into constructing random number generators and checking their properties. The idea is we ... 18$f(x)$describes the probability density rather than a probability mass in your example. In general, for continuous distributions the events—the things we get probabilities for—are ranges of values, such as for the area under the curve from$a$to$a+.1$, or from$a$to$b$(although such ranges need not be contiguous). For continuous distributions, the ... 17 why does a sequence of 8 zeroes or 8 ones seem to be equally as likely as a sequence of 4 and 4, or 5 and 3, etc The aparent paradox can be summarized in two propositions, that might seem contradictory: The sequence$s_1: 00000000$(eight zeroes) is equally probable as sequence$s_2: 01010101$(four zeroes, four ones). (In general: all$2^8\$ sequences ...

16

It is plain, from looking at the question geometrically, that the expected distance between two independent, uniform, random points within a convex set is going to be a little less than half its diameter. (It should be less because it's relatively rare for the two points to be located within extreme areas like corners and more often the case they will be ...

16

I'm not aware of a universal method to generate correlated random variables with any given marginal distributions. So, I'll propose an ad hoc method to generate pairs of uniformly distributed random variables with a given (Pearson) correlation. Without loss of generality, I assume that the desired marginal distribution is standard uniform (i.e., the support ...

16

From a purely probabilistic perspective, both approaches are correct and hence equivalent. From an algorithmic perspective, the comparison must consider both the precision and the computing cost. Box-Muller relies on a uniform generator and costs about the same as this uniform generator. As mentioned in my comment, you can get away without sine or cosine ...

15

The earth mover distance, also known as the Wasserstein metric, measures the distance between two histograms. Essentially, it considers one histogram as a number of piles of dirt and then assesses how much dirt one needs to move and how far (!) to turn this histogram into the other. You would measure the distance between your distribution and a uniform one ...

Only top voted, non community-wiki answers of a minimum length are eligible