Date: May 8, 2013 11:45 PM
Author: dpb
Subject: Re: Stupid question ;)

On 5/8/2013 10:10 PM, SK wrote:
> Hi,
>
> I have a simple question but I did not manage to find the solution.
> I am working on some block bootstrap resampling methods, and I need to
> take a vector x with some data and divide it into blocks and then
> resample these blocks.
>
> Let me show you one on simple example
>
> step 1 : I take x = [ 1:20 ]
> step 2 : I created a matlab function that give me these blocks from x;
> u =
>
> 1 4 7 10 13 16
> 2 5 8 11 14 17
> 3 6 9 12 15 18
>
> step 3: I want now to create a vector or a matrix named B with
> B(1)=u(:,1)
> B(2)=u(:,2)
> B(3)=u(:,3)
> B(4)=u(:,4)
> B(5)=u(:,5)
> B(6)=u(:,6)
>
> How to create B?
>
> When I will have B, I will just create a lot of resamples with
> replacement of these blocks
> for example X = [ B(1) B(1) B(6) B(4) B(3) B(1)]


Just like you wrote it---but there's really no need; just use

X = [u(:,randperm(size(u,2)))];

--