Results 1 to 4 of 4

Normal distribution

Threaded View

  1. #1
    Registered User
    Join Date
    02-07-2008
    Posts
    14

    Normal distribution

    What's the consensus about the Box-Müller transform? Is it a statistically and numerically sound way to get normally distributed numbers in Excel?

    'Box-Müller transform
    Dim z1 As Double, z2 As Double, x1 As Double, x2 As Double
    x1 = Rnd
    x2 = Rnd
    z1 = Sqr(-2 * Log(x1)) * Cos(2 * 3.14159265 * x2)
    z2 = Sqr(-2 * Log(x1)) * Sin(2 * 3.14159265 * x2)

    It was about 500 times faster for me than using

    z = Application.WorksheetFunction.NormInv(Rnd, 0, 1) 'or (Rnd, mean, stddev)

    The result seemed to be bell-shaped. I plotted it in Matlab, Excel should add a histogram wizard.
    Last edited by VBA Noob; 03-06-2008 at 10:36 AM.

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