Series not filled with values after loop

For questions regarding programming in the EViews programming language.

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

Mig
Posts: 6
Joined: Thu Jan 26, 2012 11:10 am

Series not filled with values after loop

Postby Mig » Thu Jan 26, 2012 11:28 am

Hi,
I'm pretty new to eViews (actually I started working with it 3 days ago :) ) and i need to make a presentation about break in time-series, so i wrote the following source-code. My Problem is that without the loops the series y, t, adf, .... is filled with values. But when i put the loops in the source-code the series are not filled with values anymore. This leads to the resulting problem that the uroot-test isn't working.

Can anyone help me solve this problem????

Please excuse my english.


Thank you

Mig


!tmax=100

create u 1 !tmax

genr b=1
for !k = 1 to 3
for !j = 1 to 5
vector(b(1)) adf!j!k
next
next


for !k = 1 to 1
for !j = 1 to 1
for !i = 1 to b(1)

smpl 1 1
genr t!j!k=0
genr y!j!k=0
genr epsilon!j!k=0

smpl 2 100
genr t!j!k=t!j!k(-1)+1
series a!j!k=t!j!k>(9+40*(!k-1))
genr epsilon!j!k=@nrnd
genr y!j!k=t!j!k+(-10-10*(!j-1))*a!j!k+epsilon!j!k

freeze(variabel!j!k) y!j!k.uroot(const, info=sic, save=nerd)
adf!j!k(!i)=variabel!j!k(10,4)

next
next
next

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

Re: Series not filled with values after loop

Postby EViews Gareth » Thu Jan 26, 2012 11:38 am

I don't follow your question. When I run your code, it appears to work fine.

Mig
Posts: 6
Joined: Thu Jan 26, 2012 11:10 am

Re: Series not filled with values after loop

Postby Mig » Thu Jan 26, 2012 11:45 am

Sorry that it is so difficult for me to explain/ for u to read :D

When i run the code all the resulting tables (y11, ..., y53, adf1, ..., adf5, ...) are filled with "NA"s. But there shóuld be values in there... :) When i run the code without the loop (i modify the y, a, adf,... by taking away the "!j!k") the tables are filled with values. What can i do to make this work with loops.

(A loop is a "for..... next" code? at least thats what i refere to with loop :D)


Thank you for such a quick answer

Mig

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

Re: Series not filled with values after loop

Postby EViews Gareth » Thu Jan 26, 2012 11:48 am

Perhaps you posted the wrong code then - the one you posted up there doesn't create a Y53 etc...

Mig
Posts: 6
Joined: Thu Jan 26, 2012 11:10 am

Re: Series not filled with values after loop

Postby Mig » Thu Jan 26, 2012 12:24 pm

Oh sorry i see my mistake (i modyfied the loops for a test), yeah the code looks like that:

(when the code works, the b will be 5000 but for obvious reasons i keep it at 10 till then :) )



!tmax=100

create u 1 !tmax

genr b=10
for !k = 1 to 3
for !j = 1 to 5
vector(b(1)) adf!j!k
next
next


for !k = 1 to 3
for !j = 1 to 5
for !i = 1 to b(1)

smpl 1 1
genr t!j!k=0
genr y!j!k=0
genr epsilon!j!k=0

smpl 2 100
genr t!j!k=t!j!k(-1)+1
series a!j!k=t!j!k>(9+40*(!k-1))
genr epsilon!j!k=@nrnd
genr y!j!k=t!j!k+(-10-10*(!j-1))*a!j!k+epsilon!j!k

freeze(variabel!j!k) y!j!k.uroot(const, info=sic, save=nerd)
adf!j!k(!i)=variabel!j!k(10,4)

next
next
next

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

Re: Series not filled with values after loop

Postby EViews Gareth » Thu Jan 26, 2012 12:39 pm

The only problem I can see with your code is that you're not using the overwrite option in the freeze command. If I add the overwrite command, things appear to be ok, from my perspective:

Code: Select all

freeze(variabel!j!k, mode=overwrite) y!j!k.uroot(const, info=sic, save=nerd)

Mig
Posts: 6
Joined: Thu Jan 26, 2012 11:10 am

Re: Series not filled with values after loop

Postby Mig » Thu Jan 26, 2012 12:48 pm

Please excuse my constat questioning, but do the resulting e.g. y11, y12, ... are filled with numbers or "NA"s when u run the code? Cause when i run it, all the resulting series, vectores, ... are only filled with "NA"s, which is my problem... :)


Thank you a thousend times for all the help yet.


Mig

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

Re: Series not filled with values after loop

Postby EViews Gareth » Thu Jan 26, 2012 12:52 pm

Yep, filled with numbers.
Attachments
works.png
works.png (145.04 KiB) Viewed 5421 times

Mig
Posts: 6
Joined: Thu Jan 26, 2012 11:10 am

Re: Series not filled with values after loop

Postby Mig » Thu Jan 26, 2012 12:55 pm

Hmmm.... I use EViews 7 and i get only NA's. Do you have an idea why?

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

Re: Series not filled with values after loop

Postby EViews Gareth » Thu Jan 26, 2012 12:55 pm

What's the build date of your copy (help->about eviews)?

Mig
Posts: 6
Joined: Thu Jan 26, 2012 11:10 am

Re: Series not filled with values after loop

Postby Mig » Thu Jan 26, 2012 1:01 pm

OK, I'm really sorry, i just rebooted my computer and now i get numbers, prob i should update my EViews :). But Prob it works now because of the overwrite, so still thank you veryvery much.



<3 Mig


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests