"David " <david.j.ellis@saic.com> wrote in message <gmd202$fs8$1@fred.mathworks.com>...
> 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?
> I understand the basics of random number generation, skewness and all that, but am by no means an expert. any help would be appreciated
Look in Johnson, Kotz and Balakrishnan. They show
(if I recall properly) how to use a family of distributions
to produce a distribution that has a given set of the
first few moments.
In your case, as Roger suggests, you might use the
gamma distribution.
http://en.wikipedia.org/wiki/Gamma_distribution
As a function of the two parameters (k,theta) we
have
mean = k*theta
var = k*theta^2
skewness = 2/sqrt(k)
So if you wish to fit the three moments, you only
have two parameters, and they will be insufficient.
However, you can always use a three parameter
gamma distribution. The third parameter is an
origin offset, so it affects only the mean.
mean = origin + k*theta
var = k*theta^2
skewness = 2/sqrt(k)
So, given the skewness, compute k. This implies
a value for theta from the variance, then find the
origin offset from the mean.
HTH,
John
