For the case of more generic sum of n variables Xi is equal to 1.
If the apriori distribution is supposed to be uniform density
If the conditioning is
we can show that the Xi conditional probability distribution has density of
pdf(Xi | sum Xi = 1) = (n-1)*(1-x)^(n-2).
Note that for n=2, the conditioning distribution happens to be a uniform distribution. This is not true of n > 2.
One neatly way to generate a proper conditioning distribution is using n independant exponential distribution then normalize by the sum
n = 4;
Y = -log(rand(100000,n));
X = Y ./ sum(Y,2);
We can check it gives the expected conditioning distribution
x=linspace(0,1);
pdf=@(x)(n-1)*(1-x).^(n-2);
histogram(X(:),'Normalization','pdf');
hold on
plot(x,pdf(x),'MarkerSize',3);
title('exponential normamlization');
If you want further to constraint the Xi with in a lower and upper bounds, Roger Stafford's randfixedsum function does the job.
0 Comments
Sign in to comment.