+ Reply to Thread
Results 1 to 8 of 8

Generating numbers based on a probability distribution

Hybrid View

  1. #1
    Registered User
    Join Date
    08-19-2009
    Location
    Long Beach
    MS-Off Ver
    CA
    Posts
    43

    Generating numbers based on a probability distribution

    Hi,

    I would like to generate a column of data based on the following probability distribution:

    80 percent of cells = 1A
    10 percent of cells = 2B
    5 percent of cells = 3C
    3.5 percent of cells = 4D
    1.5 percent of cells = 5E

    I suspect a formula can generate this distribution of numbers but am not sure


    I have Excel 2010. Thanks for any help

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Generating numbers based on a probability distribution

    You cand use =RAND() to generate random numbers between 0 and 1. Then use this formula, with the =RAND() function in column A starting from A1, =IF(A1>0.8;"1A";IF(A1>0.1;"2B";IF(A1>0.05;"3C";IF(A1>0.035;"4D";"5E"))))

    Does it work? (Have not tested it)

    In order for it to work, you have to have a long array with random numbers.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Registered User
    Join Date
    08-19-2009
    Location
    Long Beach
    MS-Off Ver
    CA
    Posts
    43

    Re: Generating numbers based on a probability distribution

    Quote Originally Posted by Søren Larsen View Post
    You cand use =RAND() to generate random numbers between 0 and 1. Then use this formula, with the =RAND() function in column A starting from A1, =IF(A1>0.8;"1A";IF(A1>0.1;"2B";IF(A1>0.05;"3C";IF(A1>0.035;"4D";"5E"))))

    Does it work? (Have not tested it)

    In order for it to work, you have to have a long array with random numbers.


    It did not, an error popped up. Thanks for the help regardless

  4. #4
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Generating numbers based on a probability distribution

    Quote Originally Posted by Delta223 View Post
    It did not, an error popped up. Thanks for the help regardless
    Try replacing semicolons with commas.

  5. #5
    Registered User
    Join Date
    03-26-2012
    Location
    India
    MS-Off Ver
    excel 2007
    Posts
    21

    Re: Generating numbers based on a probability distribution

    Random.xlsx

    This might be useful

  6. #6
    Registered User
    Join Date
    08-19-2009
    Location
    Long Beach
    MS-Off Ver
    CA
    Posts
    43

    Re: Generating numbers based on a probability distribution

    Hi, it works now but appears not to be in proportion:

    http://i.imgur.com/uxb9e.png

    There are far too many of 2B and 5E
    (the others may also not be in proportion)
    Attached Images Attached Images
    Last edited by Delta223; 03-28-2012 at 08:11 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Generating numbers based on a probability distribution

    Hi, it works now but appears not to be in proportion
    Ahh yes; my bad. It should be like this:

    =IF(A1<=0.8,"1A",IF(A1<=0.9,"2B",IF(A1<=0.95,"3C",IF(A1<=0.985,"4D","5E"))))
    Last edited by Søren Larsen; 03-28-2012 at 08:14 AM.

  8. #8
    Registered User
    Join Date
    08-19-2009
    Location
    Long Beach
    MS-Off Ver
    CA
    Posts
    43

    Re: Generating numbers based on a probability distribution

    Works great, thanks

+ 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