dimanche 10 juillet 2016

Bootstrapping of pairs in Matlab

I would like to extend "univariate bootstrapping" to "multivariate bootsrapping", meaning in a first step I draw randomly with replacement out of a one-dimensional vector using this code:

s = RandStream.getGlobalStream();
reset(s)

n = 100000;                  % # of independent random trials
h = 52;                     % horizon
T = size(Resid_standard, 1);

Resid_bootstrapped = Resid_standard(unidrnd(T, h, n));

Now, the basic vector Resid_standard is not a uni-dimensional vector but a Tx2 matrix and I want to not only draw random numbers but random pairs.

  • How do I have to modify my code to achieve this?
  • The output in the univariate case is a 100000x50 matrix. The output for the two-dimensional case would be three-dimensional. How could I store my results?



Aucun commentaire:

Enregistrer un commentaire