Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am trying to generate random numbers within a range say 57 to 107 which are correlated by a factor of 0.8. The numbers are for illustration simplicity only.

share|improve this question
    
Presumably you want the random numbers to be uniformly distributed between $57$ and $107$? Or (approximately) normally distributed with (say) mean $82$ and standard deviation $5$? Also, correlation is a pairwise property. Do you want the correlation between $X_i$ and $X_j$ to be $0.8$ for all $i\neq j$ or just between $X_i$ and $X_{i+1}$ (and of course between $X_{i-1}$ and $X_i$ also)? –  Dilip Sarwate Nov 28 '11 at 14:15
    
@DilipSarwate : Why would you assume the correlation is supposed to be between $X_i$ and $X_{i+1}$. I'd never have guess that. I took it to mean pairs $(X_i,Y_i)$, in which the correlation between $X_i$ and $Y_i$ is $0.8$. –  Michael Hardy Nov 28 '11 at 14:30
    
@MichaelHardy I assumed the OP wanted a sequence of random numbers $X_i$. That he might have meant he wanted pairs of numbers $(X_i,Y_i)$ in which the correlation between $X_i$ and $Y_i$ is $0.8$ never occurred to me. I suppose we will have to wait for him to clarify what he wants. –  Dilip Sarwate Nov 28 '11 at 14:39
    
To Dilip Sarwate's question I will add this: Do you want a random sample from a distribution in which the correlation is $0.8$ (so that if, for example, you take a sample of 50 pairs, the correlation has high probability of being near $0.8$), or do you want to assure that the actual sample correlation will always be exactly $0.8$? (Some years ago I wrote an algorithm for the latter.) –  Michael Hardy Nov 28 '11 at 14:48
1  
I want the random numbers to be log normally distributed. Basically I am trying to generate random prices correlated to the original price series but without it going too far out of the range I want it to be in. –  Suminda Sirinath Salpitikorala Nov 28 '11 at 15:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.