On Thu, 20 Dec 2007, andreas.rosenblad(a)ltv.se wrote:
Please extend the resample() command so that it can be used with an mxn
matrix A too. Then B = resample(A) should construct a matrix where B
contains resampled rows from A.
Certainly the resample function could be modified. However, in the
meantime you have a very easy way to do it: suppose you have a matrix
A with 100 rows and 3 columns you want to draw from. All you need to do is
e = ceil(muniform(100,1)*100)
B = A[e,seq(1,3)]
This would be very useful when bootstrapping a regression model using
the
paired bootstrap method (see e.g.
http://www.stanford.edu/~zhenwei/papers/bootstrap.pdf).
Secondly, add a second argument to the resample() command where one can
choose the number of resamplings that should be drawn. E.g., if the
variable has n observations, sometimes one may want to draw m>n
resamplings. This should be possible by writing e.g. x = resample(y,m),
with the default value m=n, so that x = resample(y) draws n resamples, but
one could use x = resample(y,m) with m not equal to n.
Again, this could be done, but it's also easy to do (with m=500)
e = ceil(muniform(500,1)*100)
B = A[e,seq(1,3)]
HTH,
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti