LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 23 Oct 2007 07:23:18 -0700
Reply-To:   Hari <excel_hari@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Hari <excel_hari@YAHOO.COM>
Organization:   http://groups.google.com
Subject:   Re: Creating a Random Sample without Replacement
Comments:   To: sas-l@uga.edu
In-Reply-To:   <1193140464.159989.221170@e34g2000pro.googlegroups.com>
Content-Type:   text/plain; charset="us-ascii"

On Oct 23, 4:54 pm, Patrick <patrick.mat...@gmx.ch> wrote: > Dan, Eric > Thanks to both of you. > Got it now. > This piece of code is really a beauty. > Cheers > Patrick

Patrick,

What coincidence! I was covering the same topic today afternoon!

One way the code could be understood is by assuming that "sampsize=totobs" and mentally working out to how the code would perform. You would note that the If condition would always be true and so on. Then modify it to other extreme with "sampsize=1" and it starts to again make sense as to why the code would work.

Also one can never get less than the required Sampsize because even if "large number of initial observations are rejected" then at some point sampsize would then become equal to obsleft and so the if condition would turn true, making it accept all the rest observations.

On the mathematics -- A few years back I had been very surprised when I first saw the statement similar to (probability of picking 2 black balls from a urn having a mixture of 3 Black and 2 Red with replacement is same as the probability of picking without replacement) in one of the book for prob/stats (not able to recollect author's name ~ Washington State univ). In order to convince myself working out the proof (similar to John W) was the first step.

But the algebra didnt really cool my heart and mind. I subsequently "fabricated" an non-algebraic but a "logical" explanation as to why this property holds. In case of Without replacement --> the first item/ ball which is picked up can be theoretically considered to be a "composite" ball having 60% black ball characteristics and 40% red ball characteristics. Now, when we look back in our Urn, the proportion of black and red ball characteristics havent changed because we now have 2.4 black balls and 1.6 red balls. From this probability of picking a new black ball is 2.4/(2.4+1.6) which is again 0.6.

Not sure if the above pseudo logic works for anybody else.

hp


Back to: Top of message | Previous page | Main SAS-L page