Re: Bell shaped random number generation

From: Art Kendall (Art_at_DrKendall.org)
Date: 09/28/04


Date: Tue, 28 Sep 2004 14:01:13 GMT

A lot depends on how precisely you want to restrict the range, and how
closely you want to approximate the normal. SPSS has dozens of
distribution related functions. The example syntax below show the use of 3.
Cut, paste, and run the syntax below to see how they work.
You can cut and paste from the data window, or list the values and
cut-and paste, save as a text file, or as an Excel file, etc.

The uniform will stay in the desired range, the normal will have the
desired shape, the beta will sort of do both but not quite.

new file.
* this program generates 2000 cases with 3 differently distributed
variables.
set seed = 200409281.
input program.
loop #i = 1 to 2000.
compute x_uniform = rnd(rv.uniform(0,100)).
compute x_normal = rv.normal(50,15).
compute x_beta = rnd(100*rv.beta(2,2.5)).
end case.
end loop.
end file.
end input program.
formats x_uniform x_normal x_beta (f8.4).
descriptives variables = x_uniform x_normal x_beta
  /statistics = all.

Art
Art@DrKendall.org
Social Research Consultants
University Park, MD USA
(301) 864-5570

Harish wrote:

> Hello,
> I need to write a computer program in which I need to get random
> numbers in a range, that follow an approximation of a bell curve. I
> tell the program that the average is say 20 and also say that most of
> values lie between 15 & 25.
> The range of the values is between 0,100. I have been suggested that I
> would need to look at beta distribution to generate such numbers but I
> could not figure out how to do it.
>
> I would be thankful to you if anyonce can provide any further input in
> this regard
>
> Thanks
> Harish



Relevant Pages

  • Re: random numbers from a lognormal distribution
    ... use name "guest" and password "guest" ... end input program. ... > normal distribution but it does not include one for the lognormal. ... > dont have a super strong background in statistics so many of the posts ...
    (sci.stat.math)
  • Re: different priors (flat, uniform, etc)
    ... distribution or a Bernoulli Process, ... member of the conjugate prior family -- meaning both the prior AND ... The uniform distribution on is a Beta distribution with ... It's in every Freshman textbook in Bayesian statistics. ...
    (sci.stat.math)
  • Re: Anyone have a statistics background?
    ... > Bill Riel wrote: ... >>>the pdf of the distribution, ... >>>whatever inaccuracies are already present in Excel. ... terms of the beta distribution. ...
    (rec.audio.opinion)
  • Re: Ordered cuts of line
    ... cut to be at a fraction of the remainder that has a Beta distribution ... through use of the Beta distribution. ... related to the case you describe with the uniform distribution. ... I would appreciate comments about the dependency and the ...
    (sci.stat.math)
  • Memory As Captured By Beta-Related Distribution Functions
    ... In my previous thread on Memory Captured By Distribution Functions, ... the uniform and beta are best. ... The beta distribution function is maximum PI entropy but not maximum ...
    (sci.stat.math)

Quantcast