[R] random number generation

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Oct 28 13:42:18 CET 2003


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 distribution on the integers 
1, ..., 99 to meet your requirements: that is `just' a constrained 
non-linear optimization problem.

BTW, a random variable cannot have those characteristics: its distribution 
could, or a sample could and it is unclear which you mean.  The first is 
easier and so that's what I have assumed.

On Wed, 29 Oct 2003, nmi13 wrote:

> 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 distribution would give me the negative skewness. I need to have the 
> above mentioned descriptive statistics for the data generated.
> 
> I would be thankful to anyone who can help me with this problem.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list