[R] random number generation

2007-07-18 Thread Hadi Darzian Azizi
Hi there, I am relatively new user of R. I need to generate random number following Gamma distribution with mean 14 und st.dev 3. I read the help-text but I can not understand it well. Regards, Azizi [[alternative HTML version deleted]] __

Re: [R] random number generation

2007-07-18 Thread Francisco J. Zagmutt
Hello Hadi, See ?rgamma The Gamma distribution usually takes two parameters, shape and scale, not the mean and st. deviation. If you have data, you can estimate those parameters using MLE methods, which are nicely provided in MASS: library(MASS) fitdistr(yourdata,Gamma) Once you have your

[R] random number generation from a-/symmetric distribution

2006-09-20 Thread Garbade, Sven
Hi list, are there any functions or ideas to compute random numbers with a specific population mean and standard deviation from symmetric (but not normal) and asymmetric distributions? My first idea was to use e.g. rf() (and other R-functions for random number generation) and then scale the

Re: [R] random number generation from a-/symmetric distribution

2006-09-20 Thread mel
Garbade, Sven a écrit : Hi list, are there any functions or ideas to compute random numbers with a specific population mean and standard deviation from symmetric (but not normal) and asymmetric distributions? My first idea was to use e.g. rf() (and other R-functions for random number

[R] Random number generation

2006-06-01 Thread Carl
Hi All. (This is probably an incredibly stupid question :)) I have just noticed that every time I start an R2.3 session and request a random number (say with rnorm) that I receive the same number. AFAIK I have not set a seed at any point. Returning to an older version of R(v1.8) I get the

Re: [R] Random number generation

2006-06-01 Thread Duncan Murdoch
On 6/1/2006 3:13 PM, Carl wrote: Hi All. (This is probably an incredibly stupid question :)) I have just noticed that every time I start an R2.3 session and request a random number (say with rnorm) that I receive the same number. AFAIK I have not set a seed at any point. Returning to an

Re: [R] Random number generation

2006-06-01 Thread Dimitrios Rizopoulos
according to ?.Random.seed, `Note' section, different R sessions give differen simulation results; maybe each time you start R you load a previously saved workspace, with an existing .Random.seed, i.e., check if the .Random.seed value is the same each time you start R. I hope it helps. Best,

Re: [R] Random number generation

2006-06-01 Thread plummer
That certainly sounds like the behaviour you would get if you had a .Random.seed in your work space. If you do not save your workspace at the end of the session then the random seed will be in exactly the same state every time you start a new R session, and you will get identical simulations from

[R] random number generation

2003-10-28 Thread nmi13
Hi every one, I am trying to generate a normally distributed random variable with the following descriptive statistics, min=1, max=99, variance=125, mean=38.32, 1st quartile=38, median=40, 3rd quartile=40, skewness=-0.274. I know the rnorm will allow me to simulate random numbers with mean

[R] random number generation

2003-10-28 Thread nmi13
Hi every one, I am trying to generate a random variable with the following descriptive statistics, min=1, max=99, variance=125, mean=38.32, 1st quartile=38, median=40, 3rd quartile=40, skewness=-0.274. I tried with rgamma and as I cannot use rnorm, can any one please suggest me what

Re: [R] random number generation

2003-10-28 Thread Pascal A. Niklaus
You need to know the exact distribution of the random numbers you want to generate. For rnorm, in fact, you do not just specify the mean and the variance, but implicitely also that the data is normally distributed. Likewise, it is not sufficient to give min, max, skewness etc, you also need to

Re: [R] random number generation

2003-10-28 Thread Prof Brian Ripley
Is this a student exercise? If not, please enlighten us as to the real-world problem from which this is extracted. Given that 50% of the probability mass lies between 38 and 40, and the median and 3rd quartile are both 40, this cannot be a continuous distribution. I would design a discrete

Re: [R] random number generation

2003-10-28 Thread Peter Flom
These conditions are mutually exclusive for a lot of reasons, therefore, there's no way to generate such data. Briefly, the normal distribution is fully specified by the mean and variance, the other conditions are superfluous, and, in some cases, impossible Please tell us what you are actually