Path: news.mathworks.com!not-for-mail
From: Peter Perkins <Peter.PerkinsRemoveThis@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: help with generating skewed distribution?
Date: Wed, 20 Aug 2008 09:44:01 -0400
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <g8h731$jv0$1@fred.mathworks.com>
References: <g8466e$amb$1@fred.mathworks.com>
NNTP-Posting-Host: perkinsp.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1219239841 20448 172.31.57.88 (20 Aug 2008 13:44:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 20 Aug 2008 13:44:01 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
In-Reply-To: <g8466e$amb$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:486444



Anna Chen wrote:

> I would like to generate a population of numbers, from 1-
> 100 for example, distributed almost uniformly.  However, I 
> want the larger numbers to have more chance of popping up, 
> so the population skews to the left.


As long as you mean, "the integers from 1 to 100", and as long as you're willing to actually specify all 100 probabilities, then RANDSAMPLE is just what you need.  You might take a look at DISTTOOL, and the beta distribution.  While this is a continuous dist'n defined on the unit interval, you can fiddle with the parameters to get roughly the shape you're looking for, a=3, b=1, for example.  Then use BETAPDF to evaluate the beta density on (1:100)/101, normalize those values to sum to 1, and pass that to RANDSAMPLE, something like

   p = betapdf((1:100)/101,3,1);
   randsample(1:100,n,true,p/sum(p))

Hope this helps.