#1   Report Post  
Junior Member
 
Posts: 10
Question Drawing Sample

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 assume 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? If no, how I can write my own function using VBA?

Thanks and Regards,
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 762
Default Drawing Sample

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


"Arun Kumar Saha" wrote in message
...

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 assume
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? If
no, how I can write my own function using VBA?

Thanks and Regards,




--
Arun Kumar Saha



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default Drawing Sample

Hello,

I suggest to take my UDF redw:
http://www.sulprobil.com/html/redw.html

Regards,
Bernd
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sample program [email protected] Charts and Charting in Excel 1 February 28th 07 06:07 PM
Calculate a sample stephanie Excel Discussion (Misc queries) 0 December 14th 05 03:16 PM
The Sample Covariance Lars F Excel Discussion (Misc queries) 1 November 23rd 05 03:22 AM
SAMPLE FORMS p2416 New Users to Excel 0 November 1st 05 11:22 PM
Sample David Excel Discussion (Misc queries) 3 August 24th 05 09:03 PM


All times are GMT +1. The time now is 05:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"