Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: sampling without replacement

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25417] RE: sampling without replacement
  • From: "Johannes Ludsteck" <ludsteck at zew.de>
  • Date: Fri, 29 Sep 2000 01:07:16 -0400 (EDT)
  • Organization: Zentr. f. Europ. Wirtschaftsforsch
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Group members,
Unfortunately I deleted the mail I respond to here.
The sender wanted to know how to speed up a sampling procedure 
for sampling from a list without replacement.
The solution seems to be very simple (if I do not make a mistake):
If the list has n elements, for example
t = Table[Random[], {n}]
you get a random sample of s elements without replacement from t 
with
t[[Take[RandomPermutation[n], s]]]
 
Of course, you must include the Package
DiscreteMath`Permutations` before using RandomPermutation.
This method should be very fast. (I have not the time to try it).

Best regards,
	Johannes


Johannes Ludsteck
Centre for European Economic Research (ZEW)
Department of Labour Economics,
Human Resources and Social Policy
Phone (+49)(0)621/1235-157
Fax (+49)(0)621/1235-225

P.O.Box 103443
D-68034 Mannheim
GERMANY

Email: ludsteck at zew.de


  • Prev by Date: Re: Point inside a plygon?
  • Next by Date: Re: About N in Mathematica 4
  • Previous by thread: List element manipulation
  • Next by thread: Importing graphics, is this really supported?