Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Carl Witthoft
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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Kenn Konstabel
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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Hanke, Alex
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: [R] Sum(Random Numbers)=100

2008-07-08 Thread Patrick Burns
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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Peter Dalgaard
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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Bill.Venables
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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Richard Pearson
. 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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Daniel Malter
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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Daniel Malter
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?

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Daniel Malter
- -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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Moshe Olshansky
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

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Peng Jiang
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,

Re: [R] Sum(Random Numbers)=100

2008-07-07 Thread Shubha Vishwanath Karanth
- 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

Re: [R] Sum(Random Numbers)=100

2008-07-07 Thread Moshe Olshansky
. 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, >

[R] Sum(Random Numbers)=100

2008-07-07 Thread Shubha Vishwanath Karanth
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