Resample

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

npc
Posts: 2
Joined: Mon Mar 04, 2013 5:38 am

Resample

Postby npc » Mon Mar 04, 2013 6:19 am

Hi,

I am new to Eviews and want some help with the resample function.

If possible I want to create 1,000 resamples from an original sample (series) that has 5,000 observations. I also want each resample to be a separate series, or preferably for all the resamples to form a single matrix (i.e. 1000x5000).

If anyone is able to point me in the right direction that would be much appreciated.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13319
Joined: Tue Sep 16, 2008 5:38 pm

Re: Resample

Postby EViews Gareth » Mon Mar 04, 2013 8:40 am

Have to use a program. Here's an example:

Code: Select all

create u 5000
series x=nrnd

'resample 1,000 times.
for !i=1 to 1000
   x.resample x!i
next
Follow us on Twitter @IHSEViews

npc
Posts: 2
Joined: Mon Mar 04, 2013 5:38 am

Re: Resample

Postby npc » Thu Mar 07, 2013 7:38 am

Thanks, that's great just what I needed.

Imitation
Posts: 3
Joined: Sun Mar 22, 2015 2:04 pm

Re: Resample

Postby Imitation » Sun Mar 22, 2015 5:01 pm

Hi, I have similar problem, but in my case I'm resampling with block size=30. So some part of the code is as follows:

rndseed 12345
series open
matrix(1,1563) m1
stom(open,m1)
!nreps=1000
matrix (1563,1000) x
for !i = 1 to !nreps
@resample (m1,0,30)
next

The problem is I can't store samples from each iteration. I guess it should be something like this in the loop, but it doesn't work:

'store coefficients into matrix
colplace(resample, resample.@resample, !i)

Could you please advice on that, Thanks!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13319
Joined: Tue Sep 16, 2008 5:38 pm

Re: Resample

Postby EViews Gareth » Sun Mar 22, 2015 5:31 pm

You have to set a matrix equal to the one you're resample

Code: Select all

matrix m2 = @resample(m1,0,30)
Follow us on Twitter @IHSEViews

Imitation
Posts: 3
Joined: Sun Mar 22, 2015 2:04 pm

Re: Resample

Postby Imitation » Wed Mar 25, 2015 1:38 am

Hi,
Thanks for your prompt reply EViews Gareth.
I've tried the code with new matrix m2 but know it saves only one resampled sample, so that there is only one column of the data. I wonder what I'm doing wrong?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13319
Joined: Tue Sep 16, 2008 5:38 pm

Re: Resample

Postby EViews Gareth » Wed Mar 25, 2015 10:25 am

You have to save it into a different matrix each time.
Follow us on Twitter @IHSEViews

Imitation
Posts: 3
Joined: Sun Mar 22, 2015 2:04 pm

Re: Resample

Postby Imitation » Wed Mar 25, 2015 4:42 pm

So, it's impossible to have all resampled samples in one matrix at once and I have to do it for 1000 iterations and the loop should contain all 1000 matrices. How can I group all matrices obtained then, because I have to transfer this data into excel (hope this procedure will work at once)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13319
Joined: Tue Sep 16, 2008 5:38 pm

Re: Resample

Postby EViews Gareth » Wed Mar 25, 2015 4:51 pm

Use the matplace, or the vcat function to merge the matrices into a bigger one
Follow us on Twitter @IHSEViews


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 23 guests