Dear all,
I would like to know if there is a simple way to generate random numbers
with the constrain that they sum up to one. I am new using R...
Thanks in advance,
Núria
_
Acepta el reto MSN Premium: Correos más divertidos con
Núria Martínez napsal(a):
Dear all,
I would like to know if there is a simple way to generate random numbers
with the constrain that they sum up to one. I am new using R...
Thanks in advance,
Núria
You need to specify what 'random' means. If you have any numbers, you
can always
Petr Klasterecky wrote:
You need to specify what 'random' means. If you have any numbers, you
can always make them add-up to 1:
x - rnorm(100) #runif(100), rpois(100) etc.
x - x/sum(x)
sum(x)
I see a slight problem that may occur with dividing by sum(x) in
certain cases
Barry
Núria Martínez wrote:
Dear all,
I would like to know if there is a simple way to generate random numbers
with the constrain that they sum up to one. I am new using R...
The easiest way is to generate them by whatever method and divide by
their sum. e.g. as
(s-rexp(100))/sum(s)
Are
Barry Rowlingson napsal(a):
Petr Klasterecky wrote:
You need to specify what 'random' means. If you have any numbers, you
can always make them add-up to 1:
x - rnorm(100) #runif(100), rpois(100) etc.
x - x/sum(x)
sum(x)
I see a slight problem that may occur with dividing by sum(x)
On 06-Mar-07 Petr Klasterecky wrote:
Barry Rowlingson napsal(a):
Petr Klasterecky wrote:
You need to specify what 'random' means. If you have any numbers,
you can always make them add-up to 1:
x - rnorm(100) #runif(100), rpois(100) etc.
x - x/sum(x)
sum(x)
I see a slight problem that
Ted Harding wrote:
And, specifically (to take just 2 RVs X and Y), while U = X/(X+Y)
and V = Y/(A+Y) are two RVs which summ to 1, the distribution of U
is not the same as the distribution of X conditional on (X+Y = 1).
This question appeared in October 2006, and the answer was
the Dirichlet
On 06-Mar-07 Alberto Monteiro wrote:
Ted Harding wrote:
And, specifically (to take just 2 RVs X and Y), while U = X/(X+Y)
and V = Y/(A+Y) are two RVs which summ to 1, the distribution of U
is not the same as the distribution of X conditional on (X+Y = 1).
This question
Which question?