how to make chi^2 noise

My knowledge of the relationship between the gamma distribution and the chi^2 distribution is NULL beyond knowing that the chi^2 is a special case of the gamma. I'd like to make a wave of chi^2 distributed noise with a specific number of degress of freedom and it seems like I'd be able to make the gammaNoise function do this if I only understood how.

Ultimately what I'm after are expected quartiles of a chi^2 distribution with some specific # of degrees of freedom so if there's some other way of going about this with Igor's built in chi^2 pdf/cdf functions please feel free to show me the light!

Thanks.
The relationship between gamma and chi-squared is that when 2*a (see help for gammaNoise) is an integer then the distribution is that of chi-squared with 2a degrees of freedom. See "Statistical Distributions" (3rd ed.) by Evans, Hastings and Peacock.

Otherwise, since you have access to StatsChiPDF() and enoise(), you can generate pseudo-random numbers from the Chi-squared distribution using the rejection method. It is described, for example, here: http://en.wikipedia.org/wiki/Rejection_sampling.

You might also want to take a look at analytic expressions for the expectation values that you are after. You may be able to get closed-form expressions for them (at least for chi-squared distribution).

A.G.
WaveMetrics, Inc.
Thanks for the reply - I guess this leads me to a second question. How to I get random numbers between 0 and 1 in Igor? I'm familiar with enoise, gnoise, etc and enoise seems the closest but since enoise(1) returns values from -1 to 1 I don't understand how to select only the positive values and not interfere with the "randomness" of the result. Also it seems hard to control how many values I get back.

So what I'm thinking now is if I were to be able to create a wave of say 100 points containing values on the range of 0 to 1 I can convert these to a chi^2 distribution with 3 degrees of freedom with the StatsInvChiCdf function.

I just don't know what a truly random way is of getting that random set of values between 0 and 1.
cool, thanks. all i wanted was to see someone who i consider to be an authority on randomness give me an answer so it's not just something i came up with myself.

Inverse Transform Sampling with N degrees of freedom:

print StatsInvChiCDF(abs(enoise(1)),N)