How to get a uniformly distributed portfolio allocation vector? [duplicate]

Imagine we have a portfolio allocation vector $(x_1, ..., x_n)$ with $x_1+...+x_n=1$; Also we assume that the vector has only elements $\geq 0$, so we have $|x_1|+...+|x_n|=1$, so no short selling;

I want to generate such vectors $x$ and I want that they are somehow uniformly distributed on the set of possible values;

In a paper I read to generate $y_1, ... y_n \sim \text{Exp}(1)$ i.i.d. and then set: $x_i=y_i/(\sum\limits_{j=1}^{n}y_j)$;

Now it is obvious that the sum of elements of the generated vector is 1 but why do I use the exponential distribution? What advantage do I get? Isn't is more reasonable to take e.g. $y_i$ to be uniformly distributed on [0,1] and then again set $x_i=y_i/(\sum\limits_{j=1}^{n}y_j)$?

• This generates a particular Dirichlet distribution -- the symmetric Dirichlet (with all $\alpha_i=1$ in this case). To see why, see the discussion of its relationship to the gamma distribution Commented Jul 25, 2017 at 11:19
• And because all $\alpha_i$ as in the definition of the density on wikipedia are equal to 1, the density itself is just a constant - and therefore we indeed have uniform distribution, right?
– user151503
Commented Jul 25, 2017 at 12:10
• The multivariate density is uniform over the $n-1$ simplex, but that's not normally called a uniform distribution, it's a particular Dirichlet - specifically the one with all $\alpha$'s $1$ is called the flat Dirichlet. Many multivariate densities that are uniformly dense over some specific region and 0 elsewhere are not called uniform distributions; you describe them by mentioning that they're uniform over the specific region that they are uniform over (as the Wikipedia article does), but they typically have some other name. To be called a uniform distribution requires more than that. Commented Jul 25, 2017 at 15:02

I want to generate such vectors x and I want that they are somehow uniformly distributed on the set of possible values

There is a well-known way of generating this (I cannot seem to find a reference, though).

Generate $n - 1$ i.i.d. points $Y_1, \ldots, Y_{n - 1}$ each $\sim \mathcal{U}(0, 1)$, and sort them in increasing order; call the result $X_1, \ldots, X_{n - 1}$, and define $(X_0, X_n) = (0, 1)$. Then your random sample is

$$X_1 - X_0, X_2 - X_1, \ldots, X_n - X_{n - 1}.$$

Why does this work? Suppose you have a circle centered around the origin, and you generate $n$ points uniformly on the circumference. Then, by symmetry, the angular difference between successive points, divided by $2 \pi$, is exactly what you want. Rotating the circle so that one of the points is at the positive x axis, however, (so that you only need to generate $n - 1$ points), gives exactly the previous construction.

• Also looks like a nice way - thanks; But if you don't mind I still prefer the comment of Glen_b since then the uniform distribution on the set is already obvious and then doesn't need to be proven.... But still thank you for your idea - I'll keep it in mind
– user151503
Commented Jul 25, 2017 at 12:12
• @J.Doe Of course, no problem. Good luck. Commented Jul 25, 2017 at 12:31
• For references, please see stats.stackexchange.com/….
– whuber
Commented Jul 25, 2017 at 14:13