http://www.mathworks.com/matlabcentral/newsreader/view_thread/243788
MATLAB Central Newsreader  random variable skewness
Feed for thread: random variable skewness
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Wed, 04 Feb 2009 21:40:18 +0000
random variable skewness
http://www.mathworks.com/matlabcentral/newsreader/view_thread/243788#626190
David
I am trying to create a random number generator that accounts for a mean, std, and skewness. of course I could use randn() if it was just mean and std, but I need to account for skewness since my number in reality can't be negative and a sigma value would make it so. Is there some way to account for skewness in matlab? Or is it more complicated than that? <br>
I understand the basics of random number generation, skewness and all that, but am by no means an expert. any help would be appreciated

Wed, 04 Feb 2009 23:24:01 +0000
Re: random variable skewness
http://www.mathworks.com/matlabcentral/newsreader/view_thread/243788#626223
Roger Stafford
"David " <david.j.ellis@saic.com> wrote in message <gmd202$fs8$1@fred.mathworks.com>...<br>
> I am trying to create a random number generator that accounts for a mean, std, and skewness. of course I could use randn() if it was just mean and std, but I need to account for skewness since my number in reality can't be negative and a sigma value would make it so. Is there some way to account for skewness in matlab? Or is it more complicated than that? <br>
> I understand the basics of random number generation, skewness and all that, but am by no means an expert. any help would be appreciated<br>
<br>
You could use something like the Gamma distribution which is never negative. Mathworks has the 'gamrnd' generator on the Statistics Toolbox. Its parameters can be set to match a desired mean and standard deviation. It has a skewness value but the amount of that is determined by the mean and standard deviation values. See the site <a href="http://en.wikipedia.org/wiki/Gamma_distribution">http://en.wikipedia.org/wiki/Gamma_distribution</a>. Maybe this will give you some ideas for other kinds of distributions.<br>
<br>
Roger Stafford

Thu, 05 Feb 2009 00:05:05 +0000
Re: random variable skewness
http://www.mathworks.com/matlabcentral/newsreader/view_thread/243788#626225
John D'Errico
"David " <david.j.ellis@saic.com> wrote in message <gmd202$fs8$1@fred.mathworks.com>...<br>
> I am trying to create a random number generator that accounts for a mean, std, and skewness. of course I could use randn() if it was just mean and std, but I need to account for skewness since my number in reality can't be negative and a sigma value would make it so. Is there some way to account for skewness in matlab? Or is it more complicated than that? <br>
> I understand the basics of random number generation, skewness and all that, but am by no means an expert. any help would be appreciated<br>
<br>
Look in Johnson, Kotz and Balakrishnan. They show<br>
(if I recall properly) how to use a family of distributions<br>
to produce a distribution that has a given set of the<br>
first few moments.<br>
<br>
In your case, as Roger suggests, you might use the<br>
gamma distribution.<br>
<br>
<a href="http://en.wikipedia.org/wiki/Gamma_distribution">http://en.wikipedia.org/wiki/Gamma_distribution</a><br>
<br>
As a function of the two parameters (k,theta) we<br>
have<br>
<br>
mean = k*theta<br>
var = k*theta^2<br>
skewness = 2/sqrt(k)<br>
<br>
So if you wish to fit the three moments, you only<br>
have two parameters, and they will be insufficient.<br>
However, you can always use a three parameter<br>
gamma distribution. The third parameter is an<br>
origin offset, so it affects only the mean.<br>
<br>
mean = origin + k*theta<br>
var = k*theta^2<br>
skewness = 2/sqrt(k)<br>
<br>
So, given the skewness, compute k. This implies<br>
a value for theta from the variance, then find the<br>
origin offset from the mean.<br>
<br>
HTH,<br>
John

Mon, 09 Feb 2009 15:53:55 +0000
Re: random variable skewness
http://www.mathworks.com/matlabcentral/newsreader/view_thread/243788#627104
Peter Perkins
David wrote:<br>
> I am trying to create a random number generator that accounts for a mean, std, and skewness.<br>
<br>
If you have access to the Statistics Toolbox, use PEARSRND or JOHNSRND, to generate values from either the Pearson System or the Johnson System of distributions. The former allows you to specify the first four moments, the latter allows you to specify desired quantiles.