"sun" <[EMAIL PROTECTED]> writes:

> I am trying to generate a vector of random numbers with the constraint that 
> they have to sum up to one with uniform distribution.
> 
> eg. {0.1,0.7,0.2 }
> 
> any function to do this? Thanks.

Depending on what you mean by "uniform", this may be a solution

> x<-runif(3)
> x/sum(x)
[1] 0.1130642 0.4098608 0.4770750

What you can't have is the individual components uniform and
identically distributed because the sum of the means would be 1.5 and
equal to the mean of the sum which is 1...

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to