+ Reply to Thread
Results 1 to 5 of 5

Generating correlated random uniform numbers

  1. #1
    Registered User
    Join Date
    06-20-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    3

    Generating correlated random uniform numbers

    Hi there,

    I'm looking to generate correlated random unifrom variables between 0 and 1 using the excel random number generator, rand(), and a user defined correlation matrix - without the use of a plugin.

    After searching someone directed me to the 'cholesky function' which I've tried to use in the attached file.

    Problem is that half the time the last resulting variable is above 1 and they are in increasing order.

    Can anyone point me in the right direction please?
    Attached Files Attached Files
    Last edited by huntp1; 06-20-2012 at 06:51 AM.

  2. #2
    Registered User
    Join Date
    06-20-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Generating correlated random uniform numbers

    bump, anyone?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Generating correlated random uniform numbers

    Maybe ...

    A2: =RAND()

    B2: =RAND()

    C2: =(Correl*A2 + SQRT(1-Correl^2)*B2)/(Correl + SQRT(1-Correl^2))

    A2 and C2 have the specified correlation
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Generating correlated random uniform numbers

    Maybe for a more pleasing distribution ...

    Generate a pair of correlated random normal deviates (I can post code) and convert those via =NORMSDIST(A2) and =NORMSDIST(B2)

  5. #5
    Registered User
    Join Date
    06-20-2012
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Generating correlated random uniform numbers

    Yes, but then a2 and b2 would be uncorrelated. The 3 number version I gave is really just an example. I'm looking for something more robust, that would provide correlation for around ten different numbers.

    I realise there are plenty of risk plugins I could use, but was looking for something excel/vba reliant so I could distribute it without the user having to install anything.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1