Drawing Sample

A

Arun Kumar Saha

Hi all,

I want to draw a random sample [with replacement] of size 10 (suppose
from a population having members : 1, 2, 3, and 4, where I assum
following:

Probability that 1 will be drawn is : 0.1
Probability that 2 will be drawn is : 0.4
Probability that 3 will be drawn is : 0.4
Probability that 4 will be drawn is : 0.1

Can anyone tell me that : is there any VBA function for doing that? I
no, how I can write my own function using VBA?

Thanks and Regards
 
M

Mike Middleton

Arun Kumar Saha -

Here's a non-VBA solution, using nested IF functions and the cumulative
distribution:

Enter =RAND() into a cell, e.g., cell A1.

In another cell, e.g., B1, enter
=IF(A1<=0.1,1,IF(A1<=0.5,2,IF(A1<=0.9,3,4)))

Copy A1:B1 and paste into A2:B10. Press F9 to debug.

Or, download the tryout version of RiskSim from www.treeplan.com, and use
its RANDDISCRETE function.

- Mike Middleton
http://www.DecisionToolworks.com
Decision Analysis Add-ins for Excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top