quote: In the present case use rmultinom(1, 100, rep(1/50,50))
At least in my version, rmultinom normalizes the last argument,
so rep(1,50) works just as well.
Back to the original problem: either assign 49 randoms and give the
remainder to the 50th slot, or do the right thing :-) :
You hav
On Tue, Jul 8, 2008 at 9:53 AM, Shubha Vishwanath Karanth <
[EMAIL PROTECTED]> wrote:
> ...actually I need to allocate certain amount of money (here I mentioned
> it as 100) to a randomly selected stocks(50 stocks)... i.e., 100 being
> divided among 50 stocks and preferably all are integer allocat
and p = 1/49; if X2 = k2 then
> generate X3 binomial with size = 100 -(k1+k2) and p = 1/48, etc.
>
> Why do you need this?
>
>
> --- On Tue, 8/7/08, Shubha Vishwanath Karanth
> <[EMAIL PROTECTED]
> > wrote:
>
>> From: Shubha Vishwanath Karanth <[EMAIL PROT
re integer allocations(i.e.,
5 8 56 12 etc without any decimals)...
Thank you,
Shubha
-Original Message-
From: Moshe Olshansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2008 12:09 PM
To: [EMAIL PROTECTED]; Shubha Vishwanath Karanth
Subject: Re: [R] Sum(Random Numbers)=100
If they
Richard Pearson wrote:
Shubha
Does table(ceiling(runif(100,0,50))) give you something like you want?
That's a neat(-ish) solution of Moshe's multinomial formulation.
More generally, if p is a vector of probabilities you can simulate
independent indicators with cut(runif(N), c(0,cumsum(p)) and
ROTECTED] On Behalf Of Daniel Malter
Sent: Tuesday, 8 July 2008 5:32 PM
To: 'Shubha Vishwanath Karanth'; [EMAIL PROTECTED]
Subject: Re: [R] Sum(Random Numbers)=100
For some reason, the while-loop I sent did not work. It was running forever
although I don't know why. Anyway, using r
.
Why do you need this?
--- On Tue, 8/7/08, Shubha Vishwanath Karanth <[EMAIL PROTECTED]>
wrote:
From: Shubha Vishwanath Karanth <[EMAIL PROTECTED]>
Subject: [R] Sum(Random Numbers)=100
To: [EMAIL PROTECTED]
Received: Tuesday, 8 July, 2008, 3:58 PM
Hi R,
I need to generate 50 ra
liche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Shubha Vishwanath Karanth
Gesendet: Tuesday, July 08, 2008 1:59 AM
An: [EMAIL PROTECTED]
Betreff: [R] Sum(Random Numbers)=100
Hi R,
I need to generate 50 random numbers (preferably poisson), such that their
s
CTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Shubha Vishwanath Karanth
Gesendet: Tuesday, July 08, 2008 1:59 AM
An: [EMAIL PROTECTED]
Betreff: [R] Sum(Random Numbers)=100
Hi R,
I need to generate 50 random numbers (preferably poisson), such that their
sum is equal to 100. How do I do this?
-
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Shubha Vishwanath Karanth
Gesendet: Tuesday, July 08, 2008 2:54 AM
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: Re: [R] Sum(Random Numbers)=100
...actually I need to allocate certain amount of money (here I
times, which is very reasonable.
--- On Tue, 8/7/08, Peng Jiang <[EMAIL PROTECTED]> wrote:
> From: Peng Jiang <[EMAIL PROTECTED]>
> Subject: Re: [R] Sum(Random Numbers)=100
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED], "Shubha Vishwanath Karanth" <[EMA
omial with size = 100 -(k1+k2) and p = 1/48, etc.
Why do you need this?
--- On Tue, 8/7/08, Shubha Vishwanath Karanth <[EMAIL PROTECTED]
> wrote:
From: Shubha Vishwanath Karanth <[EMAIL PROTECTED]>
Subject: [R] Sum(Random Numbers)=100
To: [EMAIL PROTECTED]
Received: Tuesday, 8 July,
-
From: Moshe Olshansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2008 12:09 PM
To: [EMAIL PROTECTED]; Shubha Vishwanath Karanth
Subject: Re: [R] Sum(Random Numbers)=100
If they are really random you can not expect their sum to be 100.
However, it is not difficult to get that given that
.
Why do you need this?
--- On Tue, 8/7/08, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote:
> From: Shubha Vishwanath Karanth <[EMAIL PROTECTED]>
> Subject: [R] Sum(Random Numbers)=100
> To: [EMAIL PROTECTED]
> Received: Tuesday, 8 July, 2008, 3:58 PM
> Hi R,
>
Hi R,
I need to generate 50 random numbers (preferably poisson), such that
their sum is equal to 100. How do I do this?
Thank you,
Shubha
This e-mail may contain confidential and/or privileged i...{{dropped:13}}
__
R-help@r-project.org ma
15 matches
Mail list logo