Recursive Sampling

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Recursive Sampling

Postby rmoralesaramburu » Mon Dec 02, 2013 3:10 pm

Hello, is there an easy way to do this? I want to first define the samples, and then use a loop to make this.

Code: Select all

matrix(60,7) nfp_rec smpl 1961m02 1961m02 !x=@mean(nonfarm_payrolls) for !i=0 to 59 smpl 1961m02+!i 1961m02+!i !y=@mean(nonfarm_payrolls) matrix nfp_rec(!i+1,1)=100*!y/!x next smpl 1970m11 1970m11 !x=@mean(nonfarm_payrolls) for !i=0 to 59 smpl 1970m11+!i 1970m11+!i !y=@mean(nonfarm_payrolls) matrix nfp_rec(!i+1,2)=100*!y/!x next smpl 1975m3 1975m3 !x=@mean(nonfarm_payrolls) for !i=0 to 59 smpl 1975m3+!i 1975m3+!i !y=@mean(nonfarm_payrolls) matrix nfp_rec(!i+1,3)=100*!y/!x next smpl 1982m11 1982m11 !x=@mean(nonfarm_payrolls) for !i=0 to 59 smpl 1982m11+!i 1982m11+!i !y=@mean(nonfarm_payrolls) matrix nfp_rec(!i+1,4)=100*!y/!x next smpl 1991m3 1991m3 !x=@mean(nonfarm_payrolls) for !i=0 to 59 smpl 1991m3+!i 1991m3+!i !y=@mean(nonfarm_payrolls) matrix nfp_rec(!i+1,5)=100*!y/!x next smpl 2001m11 2001m11 !x=@mean(nonfarm_payrolls) for !i=0 to 59 smpl 2001m11+!i 2001m11+!i !y=@mean(nonfarm_payrolls) matrix nfp_rec(!i+1,6)=100*!y/!x next smpl 2009m6 2009m6 !x=@mean(nonfarm_payrolls) for !i=0 to 59 smpl 2009m6+!i 2009m6+!i !y=@mean(nonfarm_payrolls) matrix nfp_rec(!i+1,7)=100*!y/!x next

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

Re: Recursive Sampling

Postby EViews Gareth » Mon Dec 02, 2013 3:17 pm

Perhaps you could define what "this" is?

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Recursive Sampling

Postby rmoralesaramburu » Mon Dec 02, 2013 3:50 pm

In my last post I wrote a code. I am creating 7 series into a matrix of 60 rows.

I would like to first define the samples, and then loop to generate the 7 series.

For example

sample s1 1961m02 1961m02
sample s2 1970m11 1970m11

then take this definitions inside the loop I am doing in my below post

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

Re: Recursive Sampling

Postby EViews Gareth » Mon Dec 02, 2013 4:04 pm

Well, the problem is that your code is not easy to follow and work out what you want.

I suppose the starting question is, if you already have code that does it, why do you need help?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests