Thanks a lot for all your input!!
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-generate-a-set-of-random-numbers-that-sum-to-1-with-uniform-distribution-of-elements-tp4648695p4648973.html
Sent from the R help mailing list archive at Nabble.com.
The Dirichlet distribution will give values that sum to one and with the
correct conditions will have uniform margins. There are multiple packages
that will generate data from Dirichlet distributions, either gtools or
gmodels is one of them, but there are others as well.
On Wed, Nov 7, 2012 at 6
Wed Nov 7 20:12:20 CET 2012
Re: [R] how to generate a set of random numbers that sum to 1 with
uniform distribution of elements
This is a modified code if it helps.
Matrix=function(n,simulations){Tab=cbind(runif(n,0,1))
for(i in 2
On Nov 7, 2012, at 10:48 AM, Albyn Jones wrote:
> What uniform distribution do you want for the columns? The average
> value of X_k given \sum X_i = 1 must be 1/n. If you start with
> X_i ~ U(0,1), the result must be skewed.
>
> If you generate X_i uniformly distributed on (0, 2/n), the condi
mb.gad...@gmail.com]
Sent: Thursday, November 08, 2012 12:26 AM
To: 'Bärbel'; 'r-help@r-project.org'
Subject: RE: [R] how to generate a set of random numbers that sum to 1 with
uniform distribution of elements
Hi,
This is a humble try.
Matrix=function(n){Tab=cbind(runif(n,0
this works
Best,
Heramb M. Gadgil
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Bärbel
Sent: Wednesday, November 07, 2012 6:32 PM
To: r-help@r-project.org
Subject: [R] how to generate a set of random numbers that sum to 1 with uniform
What uniform distribution do you want for the columns? The average
value of X_k given \sum X_i = 1 must be 1/n. If you start with
X_i ~ U(0,1), the result must be skewed.
If you generate X_i uniformly distributed on (0, 2/n), the conditional
distribution given the sum is 1 will be less skewed.
Hi,
I am looking for a way to generate a matrix of random numbers in a way that
each row of the matrix would sum to 1 and that the numbers in the columns of
the matrix would have a uniform distribution. So far I have found several
ways to create random numbers that would sum to 1, but then the dist
8 matches
Mail list logo