Re: [R] Generating random numbers satisfying specific regression equation

2013-05-25 Thread John Sorkin
(1) you need to examine the rnorm function, enter ?rnorm() (2) when you review the documentation produced by entering the command above, you will see that the rnorm function needs three parameter, the number of values to generate, the mean of the numbers to be generated, and the SD (standard dev

[R] Generating random numbers satisfying specific regression equation

2013-05-25 Thread Tobias Kisch
Hello everybody Sorry if such a question has already been posted somewhere, but I wasn’t able to find an answer yet. I’m trying to generate random numbers for illustration purposes. The random numbers should satisfy a multiple regression equation, for example: z = 0.3 + 0.05 * x + 1.5 * y +

Re: [R] Generating Random Numbers

2012-07-19 Thread Petr Savicky
On Thu, Jul 19, 2012 at 04:12:07AM -0700, arunkumar wrote: > hi > > My inputs is min=(10,10,10,10,10) and max=(100,100,100,100,100) > total = 300 > i have to generate 5 numbers between min and max and those numbers should > sum upto total Hi. Try the following. while (1) { x <- 10 +

Re: [R] Generating Random Numbers

2012-07-19 Thread arun
Sent: Thursday, July 19, 2012 7:12 AM Subject: [R] Generating Random Numbers hi My inputs is min=(10,10,10,10,10) and max=(100,100,100,100,100) total = 300 i have to generate 5 numbers between min and max and those numbers should sum upto total Can anyone help? - Thanks in Advance      

Re: [R] Generating Random Numbers

2012-07-19 Thread Petr Savicky
On Thu, Jul 19, 2012 at 04:12:07AM -0700, arunkumar wrote: > hi > > My inputs is min=(10,10,10,10,10) and max=(100,100,100,100,100) > total = 300 > i have to generate 5 numbers between min and max and those numbers should > sum upto total Hi. If we subtract the minimum from each number, then

Re: [R] Generating Random Numbers

2012-07-19 Thread Kjetil Halvorsen
Those restrictions you have given do not define a unique distribution! so you need to think better about what you need. For instance, if you want a uniform distribution between min and max with n=5 independent observations from that, but conditional upon sum=total. For that, you could use rejectio

Re: [R] Generating Random Numbers

2012-07-19 Thread Sarah Goslee
Is this homework? runif() is one way to generate random numbers, but there are others depending on the distribution desired. And of course the fifth number is deterministic. Sarah On Thu, Jul 19, 2012 at 7:12 AM, arunkumar wrote: > hi > > My inputs is min=(10,10,10,10,10) and max=(100,100,1

[R] Generating Random Numbers

2012-07-19 Thread arunkumar1111
hi My inputs is min=(10,10,10,10,10) and max=(100,100,100,100,100) total = 300 i have to generate 5 numbers between min and max and those numbers should sum upto total Can anyone help? - Thanks in Advance Arun -- View this message in context: http://r.789695.n4.nabble.com/Generating