Correlation Coefficients of Random NumbersDate: 12/18/2000 at 02:06:36 From: Anand Subject: Random number generation Hi Dr. Math, As a part of a research problem, I have to generate random numbers that have a certain correlation coefficient. I am using the C language to simulate a certain environment and have been desperately searching for a random number generator that can produce a bunch of random numbers that are, say, positively correlated with a coefficient of 0.5. Could you suggest any sources for such information, or a C program capable of doing this? My research work hinges on this simulation environment and this problem had been driving me crazy. I would be truly indebted to you if you could give me some kind of lead on this. Thank you. Hoping sincerely to get an answer from you... Anand Date: 12/18/2000 at 05:29:20 From: Doctor Mitteldorf Subject: Re: Random number generation Dear Anand, Generating such a function isn't hard, but understanding how to use it might be. Make pairs x[i] and y[i], in which the first is completely random but the second is a multiple of x plus a random part: x[i]=rand(); y[i]=a*x[i]+b*rand(); You should prove to your own satisfaction that the correlation coefficient for many x and y variables so generated is a/sqrt(a^2+b^2) Hence, you can solve backward to choose a and b so as to get the correlation coefficient that you want. - Doctor Mitteldorf, The Math Forum http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.
http://mathforum.org/dr.math/