Page 1 of 1

Resampling Columns of a Matrix

Posted: Mon Apr 01, 2013 3:06 pm
by uchuk
Hi,

I want to bootstrap not rows of a matrix, but cols. Since to the my knowledge Eviews does not have a command for this situation, first I transposed the matrix, then resampled. But Eviews does not exactly resample the rows of the new matrix. The code is below

matrix bootkal1 = @transpose(bootkal)
matrix bootkal2 = @resample(bootkal1)

The result is

37.78425311004244 42.12208576778759 44.65110673041997
3.487714269148301 3.544167370822096 3.741550594033354
34.85880001852675 36.60544090217692 43.9921886220723
3.573937242919356 3.490016999370026 3.471114415859684
37.78425311004244 42.12208576778759 44.65110673041997

(I summarized the results).

As it can be seen in the results, always the first and last rows of the matrix is same, so it does not exaclty resample. Although I determine the number of the bootstrap as 10000. When I do not transpose the matrix "bootkal", the code is really resampling. How I can solve this problem? Any suggestions? :eviews6:

Re: Resampling Columns of a Matrix

Posted: Mon Apr 01, 2013 3:22 pm
by EViews Gareth
Are you sure?

I just ran an example, and it worked fine.

Code: Select all

create u 10 'create random matrix matrix(3,40) bootkal rnd(bootkal) matrix bootkal1 = @transpose(bootkal) matrix bootkal2 = @resample(bootkal1) show bootkal1 show bootkal2

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 12:06 am
by uchuk
Hi again,

Again I got the same wrong results when I modify the code as follows. The resample code works fine when using "transpose" but it does not work fine in the cases of cols>rows matrices. There are same rows in the resulting matrix.


create u 10

'create random matrix
matrix(3,40) bootkal
rnd(bootkal)

matrix bootkal2 = @resample(bootkal)

show bootkal2

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 8:15 am
by EViews Gareth
Pretty difficult to tell if there is anything going wrong (or right) with only 3 rows. You need a larger sample than that. Try this:

Code: Select all

create u 10 'create random matrix matrix(40,3) bootkal rnd(bootkal) matrix bootkal2 = @resample(bootkal)

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 10:34 am
by uchuk
Hi again,

I just increased the row of the matrix and I got the similar results:

Code: Select all

create u 10 'create random matrix matrix(20,40) bootkal rnd(bootkal) matrix bootkal2 = @resample(bootkal)
In this sample, there are about 10 rows are same exactly.

Does this problem arise since the number of cols > number of rows?

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 10:39 am
by EViews Gareth
You realise that you're doing resampling with replacement, right?

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 10:42 am
by uchuk
of course. This is a just a part of my code. I try to estimate bootstrap critical values of the panel-granger causality test of dumitrescu and hurlin (2012), but this part of the code produce these results.

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 10:48 am
by EViews Gareth
Then I'm not sure what you think is going wrong?

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 10:57 am
by uchuk
when the number of the rows of the matrix is short according to columns, "resample" produces new matrixes which have exactly same rows (for examle just now I resampled the matrices againg and there are 4 rows are the same). Therefore the wald statistics are nearly same and the critical values for the panel granger causality equals to the individual wald statistic.

Re: Resampling Columns of a Matrix

Posted: Tue Apr 02, 2013 11:00 am
by EViews Gareth
Yes, but with replacement, you expect some of the rows to be the same. That's the point.