Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Correlation Coefficients of Random Numbers


Date: 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/   
    
Associated Topics:
College Algorithms
College Statistics

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/