1
$\begingroup$

I am trying to generate N random samples in J dimensions subject to a constraint. Each dimension j is bounded by a unique "Lower_Bound" and "Upper_Bound," which both are bounded [0,1]. The constraint is that the sum across j for each sample n = 1.0. EG, for each n, the sum of j(i) = 1.

Owing to the potential of uniques range for every dimension, it is not obvious to me how I can generate the samples to ensure a uniform distribution over the space. Simply creating an RV for each j-th element in order would bias the results.

I have come up a (possibly inelegant) solution: I generate an ordered list of length J, which I shuffle for every iteration of N. I then using each shuffled list to generate j(i).

Query - does this generate samples uniformly distributed over the space, and is there a statistical test I can perform to quantify the uniformity? By uniformly distributed, I mean there is an equal probability of picking any point on the J dimensional surface.

The reason I raise this point is because most of the sampling algorithms I have come up with have subtle biases which result in some parts of the space being sampled more than others.

I need an analogue to a Gini coeffecient, I am out of my depth here!

$\endgroup$
8
  • $\begingroup$ Although this is asked in conjunction w/ Python code, it seems like there is a meaningful statistical question underneath it. I am inclined to leave this open. $\endgroup$ Nov 20, 2015 at 19:03
  • $\begingroup$ @gung I agree. Voting leave open. $\endgroup$ Nov 20, 2015 at 20:37
  • 1
    $\begingroup$ What do you mean by "uniformly distributed over J space"? Is it that you'd like each of N J-dimensional variables to be roughly even? Meaning you'd prefer vectors like $\langle 0.5 0.5 \rangle$ to $\langle 0.99 0.01\rangle?$ $\endgroup$ Nov 20, 2015 at 20:41
  • 1
    $\begingroup$ Thanks, that's helpful. And over what dimension must they sum to 1? Is that across your sample of $n$, the $j$ dimension must sum to 1? (A small sample of how the data should look might help potential answerers see what you're aiming for.) $\endgroup$ Nov 21, 2015 at 15:16
  • 1
    $\begingroup$ I really don't understand this question: something about "The constraint is that the sum across j for each sample n = 1.0." is garbled. Further references to "J space" and "hypersurface" and "unique length" in comments are equally puzzling--these terms, since they are used in such a vague manner, could be interpreted in many different ways. Could you please edit the question as requested by @SeanEaster? $\endgroup$
    – whuber
    Nov 21, 2015 at 15:41

1 Answer 1

0
$\begingroup$

How about generating the values uniformly between 0 and 1, then normalizing them by dividing each by the sum?

Edit: I think what you mean by 'hypersurface' is usually called a 'simplex.' There are some pretty standard techniques for uniformly sampling on a unit simplex, explained nicely in this question: https://cs.stackexchange.com/questions/3227/uniform-sampling-from-a-simplex

You can adapt this technique to your problem. I think all that you need to do is scale the samples into your bounds after generating the values.

$\endgroup$
1
  • $\begingroup$ No - Please note that each dimension j has a unique lower and upper bound. $\endgroup$
    – GPB
    Nov 20, 2015 at 21:31

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