2
$\begingroup$

I am trying to understand what sort of distribution is produced by the following code.

Using the following Matlab code we can generate a distribution (normalized such that the sum of the set is equal to 1):

M=500; % Number of samples
z=5;
SUM = 1;
ns = rand(1,M).^z; % Uniformly distributed random numbers to the power of z
TOT = sum(ns);
X = (ns/TOT)*SUM; % Re-scaling
hist(X(1,:),100)

For the exponent $z=1$ the sampling distribution is essentially "flat", and it also has a small range. Enlarging $z$ gives a wider range of numbers. Here is an example:

enter image description here

I would like to classify this distribution and understand the underlying mathematics.

Any explanations would be greatly appreciated.

$\endgroup$
  • 1
    $\begingroup$ Similar method, different distribution. Not sure that makes it a duplicate. $\endgroup$ – BruceET Jun 18 at 17:30
  • 3
    $\begingroup$ @AdamO the question you link to is about $e^X$ where $X \sim \text{Uniform}(0, 1)$ while this question is asking about $X^z$. This leads to a different distribution. $\endgroup$ – olooney Jun 18 at 17:35
5
$\begingroup$

I will show this for $U^2,$ instead of $U^5.$ See @olooney's comment below my Answer.

Short answer: If $U \sim \mathsf{Unif}(0,1),$ then $X = U^2 \sim \mathsf{Beta}(\frac 1 2, 1).$

Proof: For $x \in (0,1),$ we have $$F_X(x) = P(X \le x) = P(U^2 \le x) = P(U \le x^{1/2}) = x^{1/2}.$$ Then $f_X(x) = F_X^\prime(x)$ is easily seen to be the density of $\mathsf{Beta}(\frac 12, 1).$ See Wikipedia on beta distributions.

Demonstration by simulation:

set.seed(618) 
u = runif(10^6);  x = u^2
mean(x)
[1] 0.3330528     # aprx E(X) = 1/3 from simulation
.5/(.5+1)
[1] 0.3333333     # exact E(X) from formula

cutp.u = seq(0, 1, by = 0.1);  cutp.x = cutp.u^2
frb = rainbow(12)
par(mfrow = c(1,3))
  hist(u, prob=T, br=cutp.u, col=frb, ylim=c(0,10), main="UNIF(0,1)")
   curve(dunif(x), 0, 1, add=T, n=10001, lwd=2)
  hist(x, prob=T, br=cutp.x, col=frb, main="BETA(.5,1)")
   curve(dbeta(x, .5, 1), add=T, lwd=2)
  hist(x, prob=T, br=40, col="skyblue2", main="BETA(.5,1)")
   curve(dbeta(x, .5, 1), add=T, n=10001, col="red")
par(mfrow = c(1,1))

enter image description here

In the first and second histograms, each bar contains about 100,000 simulated values. For the beta distribution in the middle histogram, each bar is the image of a bar of the same color in the first histogram. Ordinarily, it is not useful to make histograms with bins of unequal width, so the third histogram shows the simulated beta distribution (and its density function in red) in a more familiar way.

$\endgroup$
  • 3
    $\begingroup$ Very nice! However, because the question concerns the $z=5$ power rather than the square, it would be better to generalize your answer a little. $\endgroup$ – whuber Jun 18 at 17:34
  • 4
    $\begingroup$ Generalizes to $X^z \sim \text{Beta}(1/z, 1)$, where $X \sim \text{Uniform}(0, 1)$. $\endgroup$ – olooney Jun 18 at 17:40
  • 1
    $\begingroup$ Both absolutely correct. I'm still fussing with this. Will edit accordingly: (a) Not sure if it's homework, so want to show method without just being an answerbook. (b) Difficult to show clear graphs for $z = 5.$ $\endgroup$ – BruceET Jun 18 at 17:45
  • 1
    $\begingroup$ Thanks a lot for the explanations. No, this is not a homework problem. I was working on a physical simulation looking for a distribution that can model the distribution of light in multimode optical fibers. So I came across this distribution and I wasn't quite sure what it was. $\endgroup$ – Merin Jun 19 at 0:03
  • $\begingroup$ It seems nobody (including the OP) cares about the summation performed after the transformation. The resulting RVs are of the form $$\frac{X_i}{\sum_i X_i}$$ $\endgroup$ – gunes Jun 19 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.