How does one sample a probability vector from a simplex?
    조회 수: 5 (최근 30일)
  
       이전 댓글 표시
    
I am trying to create a program that will correctly select at random a point from an n-dimensional probability simplex. For n=2, a 2-dimensional simplex with vectors of the form (x1,x2), which projects onto to the closed interval [0,1], this is easily accomplished using the rand() function. I did it simply by defining
x1 = rand(1,1)
and
x2 = 1 - x1
But for n>2 I am not sure what the right function should be. I had been using the following simple function I created:
function rmix = randomix(k)
rmix = rand(k,1) ;
rmix = rmix/sum(rmix) ;
This function simply creates a vector of numbers (y1,...,yn) each sampled uniformly from [0,1] and then defines xi=yi/(y1+...+yn), that is, the yi's are normalized by dividing by their sum, so one does get a probability vector since x1+...+xn=1. But I realized for the n=2 case my function does not do the right sampling, because the distribution of x1=y1/(y1+y2) is not uniform (and neither is the distribution of x2). Is there a way to select a probability vector from an n-dimensional simplex that really is in effect sampling from an n-dimensional simplex uniformly?
Thanks ahead of time for your help!
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
