|
Thank you, Peter. I did notice afterwards the same-length constraint. Your suggestion to run two bootstraps in parallel is helpful. I ended up writing my own bootstrapping code to create the bootstat as a ratio of results from two vecs of different lengths, and then dovetailed the sub-functions for the bootci.
Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <hdej3j$pm2$1@fred.mathworks.com>...
> Alison wrote:
> > Has anyone made a workaround for this issue? bootstrp documentation does not constrain the input data to same size
>
> Sure it does:
>
> >> help bootstrp
> BOOTSTRP Bootstrap statistics.
> BOOTSTAT = BOOTSTRP(NBOOT,BOOTFUN,D1,...) draws NBOOT bootstrap data
> [snip]
> The third and later input arguments (D1,...) are data (scalars,
> column vectors, or matrices) that are used to create inputs to BOOTFUN.
> BOOTSTRP creates each bootstrap sample by sampling with replacement
> from the rows of the non-scalar data arguments (these must have the
> same number of rows). Scalar data are passed to BOOTFUN unchanged.
>
>
> >, but this error is thrown when passing in two vectors of different sizes (which should be fine, so long as the bootfun is designed to handle this):
>
> BOOTSTRP is designed to support the following kind of bootstrapping: The "data arguments" are thought of as a single set of data, comprising n observations on p variables (i.e., you pass in D1, D2, ... Dp, and they all have n rows). Resample with replacement from the observation, i.e., generate n random integers drawn independently from the set 1:n, and use those to index into D1, D2, ... Dp, "in parallel".
>
> BOOTSTRP accepting scalar arguments is just a convenience, to allow "tuning parameters" to be passed into your bootstrap function. It actually pre-dates anonymous functions in MATLAB, which is what we encourage people to use these days.
>
> > In case anyone is interested, the bootfun takes two vectors (each of whose elements contain only 1's and 0's), and computes a ratio of (sum1/length1) / (sum2/length2).
>
> What you've described sounds equivalent to a stratified bootstrap, which is more general than what BOOTSTRP does. It should be straight-forward for you to use BOOTSTRP as a starting point for your own function that allows that generality. What you've described would presumably require _two_ resampling operations in parallel, not the one that BOOTSTRP is prepared to do.
>
> Hope this helps.
|