PDA

Click to See Complete Forum and Search --> : sampling from defined distribution?


VBnewbie9
Sep 17th, 2007, 05:17 AM
hey guys,

i'm trying to run some monte carlo simulations and need to draw a sample from a distribution which is defined by its parameters (e.g.a normal distribution with given mean and stdev).

i have no idea how to do this. any help would be much appreciated. thanks.

-j

zaza
Sep 17th, 2007, 07:36 AM
Not entirely sure what you are asking for help with here...

VBnewbie9
Sep 17th, 2007, 07:42 AM
Not entirely sure what you are asking for help with here...

i just dont know how to do this in VB. i have no clue what sort of sub or functions you'd need to do this... i've tried searching the forums...but am not getting much. is there some critical keyword i'm lacking?

zaza
Sep 17th, 2007, 08:21 AM
Which bit don't you know how to do? Monte Carlo simulations? Generating a distribution? Sampling from a distribution?

VBnewbie9
Sep 17th, 2007, 09:02 AM
Which bit don't you know how to do? Monte Carlo simulations? Generating a distribution? Sampling from a distribution?

both generating and sampling from a distribution.

zaza
Sep 17th, 2007, 10:57 AM
There's a link in my sig to some code for generating a Gaussian random number distribution. In the past I have used this to generate n random numbers, scaled appropriately and then fed each into the bootstrap Monte Carlo method to generate the results.
The generator is effectively the same as the sample from a Gaussian, and of course you can run it many times over to get a number of different possibilities.


zaza

Rassis
Sep 17th, 2007, 04:40 PM
I donīt know how to do it in VB but it is quite easy to do it in MS-EXCEL. I think it wonīt be difficult for you to translate the code in cell I15 in sheet "data and Results" into VB.

To get new random values from the Normal distribution with parameters entered in cells I6 and I7, just press the function key F9.

Rui