[SciPy-user] Bootstrap?

Ernest Adrogué eadrogue@gmx....
Tue Jul 7 07:07:52 CDT 2009


 7/07/09 @ 06:28 (-0400), thus spake Joshua Stults:
> So basically you pass it an array of data, and it returns bootstrap
> samples (resampling from the array with replacement).

You can use the random module from Python:

In [40]: d = (1,2,3,4)

In [41]: [random.choice(d) for i in range(len(d))]
Out[41]: [4, 4, 2, 1]

In [42]: [random.choice(d) for i in range(len(d))]
Out[42]: [4, 2, 4, 2]

In [43]: [random.choice(d) for i in range(len(d))]
Out[43]: [2, 1, 2, 3]


Bye.

Ernest


More information about the SciPy-user mailing list