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 

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...


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:


You should prove to your own satisfaction that the correlation 
coefficient for many x and y variables so generated is 


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   
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- The Math Forum at NCTM. All rights reserved.