The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Simulation of 5 Random Variables with Sum Constraint
Replies: 8   Last Post: Apr 3, 2013 3:05 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bruno Luong

Posts: 9,822
Registered: 7/26/08
Re: Simulation of 5 Random Variables with Sum Constraint
Posted: Mar 28, 2013 5:34 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Siddhartha " <> wrote in message
> Thanks for the info Bruno, but the simplex generation seems to strike me as a little odd, especially as seeing that there is no fixed sum constraint.

If it's your impression then you only read superficially the thread in the link I have provided earlier.

> Let me redefine the problem better.
> a1 = [10 20 35];
> a2 = [13 19 35];
> a3 = [12 22 35];
> a4 = [15 20 35];
> a5 = [11 19 35];
> %Above are detailed the discrete possibilities for each of the 5 variables.
> %There is a 30% chance of low and high, and a 40% chance of base.
> Now, these random variables are basically percentages. So their sum can never exceed 100.
> But from some data we know that they can actually never exceed 98.

Steve already told that with 5 variables you can generate the whole set (cardinal <= 243) then randomly pick the one that verify the constraint.

If you have more variables (e.g., > 10), rejection method may be the way to go.

> I think, maybe, one can use randfixedsum for each value from min(a1) + min(a2) + min(a3) + min(a4) + min(a5) until 98, in a for loop, but again - that seems inefficient and slow, and I'm having difficulty applying it to the discrete distribution above.

Again Steve told you the discrete and continuous cases are two different problems, involving different maths. Please just pick you choice.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.