From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>

Date: Tue 10 Oct 2006 - 13:53:03 GMT

Date: Tue 10 Oct 2006 - 13:53:03 GMT

> 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

-- 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 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ R-help@stat.math.ethz.ch 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.Received on Wed Oct 11 00:05:35 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Tue 10 Oct 2006 - 16:30:09 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*