Tue Jul 7 06:25:49 CDT 2009
On Tue, Jul 7, 2009 at 6:28 AM, Joshua Stults<email@example.com> wrote:
> I was wondering if scipy had something similar to Octave/Matlab's
> empricial_rnd(). Here's the blurb from Octave's help describing the
> -- Function File: empirical_rnd (N, DATA)
> -- Function File: empirical_rnd (DATA, R, C)
> -- Function File: empirical_rnd (DATA, SZ)
> Generate a bootstrap sample of size N from the empirical
> distribution obtained from the univariate sample DATA.
> If R and C are given create a matrix with R rows and C columns. Or
> if SZ is a vector, create a matrix of size SZ.
> So basically you pass it an array of data, and it returns bootstrap
> samples (resampling from the array with replacement).
> I did a quick search on 'scipy bootstrap', 'scipy distributions' and
> 'scipy empirical_rnd', but didn't turn up anything promising. Any
> help / pointers greatly appreciated. Thanks.
> Joshua Stults
> Website: http://j-stults.blogspot.com
> SciPy-user mailing list
I was looking for bootstrap in python a while ago and didn't find much
except for one blog post.
Drawing from the data array can be done with random integers as indices:
d is data array
sample_size = len(d)
# Choose #sample_size members of d at random, with replacement
choices = numpy.random.random_integers(0, sample_size-1, sample_size)
sample = d[choices]
More information about the SciPy-user