Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Charles C. Berry
On Thu, 27 Mar 2008, Robert A LaBudde wrote: > At 05:06 PM 3/26/2008, Ted Harding wrote: >> On 26-Mar-08 21:26:59, Ala' Jaouni wrote: >>> X1,X2,X3,X4 should have independent distributions. They should be >>> between 0 and 1 and all add up to 1. Is this still possible with >>> Robert's method? >>>

Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Naji Nassar
Hi all One suggestion, tranforme the x 00 u > or < ln() (u1 & u2 are not independant) Compute u3 given the above formula Generate the x Hope this help Naji Le 26/03/08 22:41, « Ala' Jaouni » <[EMAIL PROTECTED]> a écrit : > X1,X2,X3,X4 should have independent distributions. They shoul

Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Robert A LaBudde
At 05:06 PM 3/26/2008, Ted Harding wrote: >On 26-Mar-08 21:26:59, Ala' Jaouni wrote: > > X1,X2,X3,X4 should have independent distributions. They should be > > between 0 and 1 and all add up to 1. Is this still possible with > > Robert's method? > > > > Thanks > >I don't think so. A whileago you wro

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Charles C. Berry
Ala' Jaouni gmail.com> writes: > > X1,X2,X3,X4 should have independent distributions. They should be > between 0 and 1 and all add up to 1. Is this still possible with > Robert's method? > NO. If they add to 1 they are not independent. As Ted remarked, the constraints define two simplexes an

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Ted Harding
OOPS! A mistake below. I should have written: This raises a general question: Does anyone know of an R function to sample uniformly in the interior of a general (k-r)-dimensional simplex embedded in k dimensions, with (k-r+1) given vertices? On 26-Mar-08 22:06:54, Ted Harding wrote: > On

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Ted Harding
On 26-Mar-08 21:26:59, Ala' Jaouni wrote: > X1,X2,X3,X4 should have independent distributions. They should be > between 0 and 1 and all add up to 1. Is this still possible with > Robert's method? > > Thanks I don't think so. A whileago you wrote "The numbers should be uniformly distributed" (but

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Alberto Monteiro
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

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Ala' Jaouni
X1,X2,X3,X4 should have independent distributions. They should be between 0 and 1 and all add up to 1. Is this still possible with Robert's method? Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Ala' Jaouni
X1,X2,X3,X4 should have independent distributions. They should be between 0 and 1 and all add up to 1. Is this still possible with Robert's method? Thanks On Wed, Mar 26, 2008 at 12:52 PM, Ted Harding <[EMAIL PROTECTED]> wrote: > On 26-Mar-08 20:13:50, Robert A LaBudde wrote: > > At 01:13 PM 3/2

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Ted Harding
On 26-Mar-08 20:13:50, Robert A LaBudde wrote: > At 01:13 PM 3/26/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

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Paul Smith
On Wed, Mar 26, 2008 at 7:27 PM, Ala' Jaouni <[EMAIL PROTECTED]> wrote: > I failed to mention that the X values have to be positive and between 0 and > 1. Use Robert's method, and to do his step 1, use runif (?runif) to get random numbers from the uniform distribution between 0 and 1. Paul ___

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Giovanni Petris
You have 4 random variables that satisfy 2 linear constraints, so you are trying to generate a point in a (4-2) = 2 dimensional linear (affine, in fact) subspace of R^4. If you don't have any further requirement for the distribution of the random points you want to generate, there are infinitely

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Ala' Jaouni
Hi, I failed to mention that the X values have to be positive and between 0 and 1. e.g. 0.1812*X1 + 0.1871*X2 + 0.1847*X3 + 0.2745*X4 + 0.1304*X5 = 0.2 so one possible combination of X values can be: 0.319, 0.201, 0.084, 0.26, 0.136 another possible combination: 0.151, 0.253, 0.197, 0.256, 0.14

Re: [R] generate random numbers subject to constraints

2008-03-26 Thread Robert A LaBudde
At 01:13 PM 3/26/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? 1. Generate random variates for X1, X2, based

[R] generate random numbers subject to constraints

2008-03-26 Thread Ala' Jaouni
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? Thanks, -Ala' __ R-help@r-project.org mailing list ht

[R] generate random numbers subject to constraints

2008-03-26 Thread Ala' Jaouni
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? Thanks, -Ala' [[alternative HTML version deleted]] _