[R] generate random numbers subject to constraints

Alberto Monteiro albmont at centroin.com.br
Wed Mar 26 22:36:00 CET 2008


Ala' Jaouni wrote:
>
> I am trying to generate a set of random numbers that fulfill the
> following constraints:
> 
> X1 + X2 + X3 + X4 = 1
> 
> aX1 + bX2 + cX3 + dX4 = n
> 
> where a, b, c, d, and n are known.
> 
> Any function to do this?
> 
You must give more information.

How are those numbers distributed? Are they normal? Positive?

If they can be anything, just generate X1, X2 and then compute X3, X4.

Alberto Monteiro



More information about the R-help mailing list