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:
Resampling Columns of a Matrix
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Resampling Columns of a Matrix
Are you sure?
I just ran an example, and it worked fine.
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
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
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
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Resampling Columns of a Matrix
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
Hi again,
I just increased the row of the matrix and I got the similar results:
In this sample, there are about 10 rows are same exactly.
Does this problem arise since the number of cols > number of rows?
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)Does this problem arise since the number of cols > number of rows?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Resampling Columns of a Matrix
You realise that you're doing resampling with replacement, right?
Re: Resampling Columns of a Matrix
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.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Resampling Columns of a Matrix
Then I'm not sure what you think is going wrong?
Re: Resampling Columns of a Matrix
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.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Resampling Columns of a Matrix
Yes, but with replacement, you expect some of the rows to be the same. That's the point.
Who is online
Users browsing this forum: No registered users and 2 guests
