Page 1 of 1
Resample
Posted: Mon Mar 04, 2013 6:19 am
by npc
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.
Re: Resample
Posted: Mon Mar 04, 2013 8:40 am
by EViews Gareth
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
Re: Resample
Posted: Thu Mar 07, 2013 7:38 am
by npc
Thanks, that's great just what I needed.
Re: Resample
Posted: Sun Mar 22, 2015 5:01 pm
by Imitation
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!
Re: Resample
Posted: Sun Mar 22, 2015 5:31 pm
by EViews Gareth
You have to set a matrix equal to the one you're resample
Re: Resample
Posted: Wed Mar 25, 2015 1:38 am
by Imitation
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?
Re: Resample
Posted: Wed Mar 25, 2015 10:25 am
by EViews Gareth
You have to save it into a different matrix each time.
Re: Resample
Posted: Wed Mar 25, 2015 4:42 pm
by Imitation
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)
Re: Resample
Posted: Wed Mar 25, 2015 4:51 pm
by EViews Gareth
Use the matplace, or the vcat function to merge the matrices into a bigger one