[R] random number generation

Pascal A. Niklaus Pascal.Niklaus at unibas.ch
Tue Oct 28 13:36:05 CET 2003


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 know the distribution and then maybe you can use 
runif() as base for your code.

Pascal


nmi13 wrote:

>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 38.32 
>and Sd=11.18(sqrt(125)). But I need to have the above mentioned descriptive 
>statistics for the data that I generate.
>
>I would be thankful to anyone who can help me with this problem.
>
>Regards
>Murthy
>
>  
>




More information about the R-help mailing list