ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how can I sample a number from a distribution? (https://www.excelbanter.com/excel-discussion-misc-queries/44190-how-can-i-sample-number-distribution.html)

roy

how can I sample a number from a distribution?
 
I need to sample 100 numbers out of a specified distribution (normal or
other). So basically I know the parameters, and I need Execl to sample 100
numbers. How do I do it?

Eric

Roy,

For a normal distribution,

=NORMINV(RAND(),mean,standard deviation)

Copy this down for 100 cells.

Eric


"roy" wrote:

I need to sample 100 numbers out of a specified distribution (normal or
other). So basically I know the parameters, and I need Execl to sample 100
numbers. How do I do it?


Jerry W. Lewis

In principle you can use the INV distribution functions to do this with
any distribution other than Student's t. In practice, the INV
distribution functions are too crude for serious work (the exception is
NORMINV in Excel 2003). Also, prior to Excel 2003, the RAND() function
itself is not that random.

Since this is how the Analysis ToolPak generates random variables from
various distributions, hopefully the next version of Excel will do a
better job of it.

If a serious random number generator is not required,
=TINV(RAND(),df)*SIGN(RAND()-0.5)
would be the patch for Student's t.

Jerry

Eric wrote:

Roy,

For a normal distribution,

=NORMINV(RAND(),mean,standard deviation)

Copy this down for 100 cells.

Eric


"roy" wrote:


I need to sample 100 numbers out of a specified distribution (normal or
other). So basically I know the parameters, and I need Execl to sample 100
numbers. How do I do it?




All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com