
On Tue, Jul 7, 2009 at 6:28 AM, Joshua Stults<joshua.stults@gmail.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:
?-- 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).
Be very careful and be certain you can derive the statistical justification for what you are doing when you use bootstrap. There are numerous cases in which bootstrapping will not give you the right answer, such as when fitting a function that has a parameter that is set in just a small subset of the data, because in some samples the subset may be omitted completely or in large part, admitting wildly wrong parameter values. While you didn't specify exactly what you are trying to do, for many problems Markov-Chain Monte Carlo is both better and faster, and is often easier to code. Plus, there is Python for it (pymc, I think). --jh--