Hello Everyone! Could you please help me with the codes below? My problem is that I have set the loop to be stopped when nrtf{!k}=nrtf{!j}. According to my results, nrtf3=nrtf4 but the loop does not stop and continues to produce the nrtf5 nrtf6...nrtf10. I have attached the files in this message.
Thanks you very much for the help.
'start
equation eq01
eq01.ls rt c
series nrt=@recode(rt=na,eq01.@coefs(1),rt)
equation eq02
eq02.ARCH(tdist, backcast=0.7,derive=aa) nrt c
eq02.forecast nrtf1
series nrtf1=@recode(rt=na, nrtf1,rt)
for !i = 3 to 10
!j = !i-2
!k = !i-1
equation eq{!i}
eq{!i}.ARCH(tdist,backcast=0.7,derive=aa) nrtf{!j} c
eq{!i}.forecast nrtf{!k}
series nrtf{!k} = @recode(rt=na,nrtf{!k},rt)
if nrtf{!k}=nrtf{!j}
exitloop
endif
next
Help- stop the loop
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Help- stop the loop
- Attachments
-
- program.prg
- (684 Bytes) Downloaded 222 times
-
- workfile.wf1
- (254.05 KiB) Downloaded 155 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Help- stop the loop
You cannot use if conditions on series. I'm not sure what you're trying to do, so can't help you to do it.
Re: Help- stop the loop
Eviews Gareth, thanks a lot for the reply. If the "if condition" cannot be used on series. Could you tell me how to ask a loop to stop when coefficients of the equations are the same. For example:You cannot use if conditions on series. I'm not sure what you're trying to do, so can't help you to do it.
'start
for !i = 3 to 10
equation eq{!i}
eq{!i}.ARCH(tdist,backcast=0.7,derive=aa) y{!i} c
next
'end
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Help- stop the loop
Still confused. What does checking whether two series are equal have to do with the coefficients from an equation?
To check whether the coefficients from two equations are equal, you could check the value of the maximum difference between the two sets of coefficients:
To check whether the coefficients from two equations are equal, you could check the value of the maximum difference between the two sets of coefficients:
Code: Select all
!diff = @max(@abs(eq1.@coef-eq2.@coef))
Re: Help- stop the loop
Still confused. What does checking whether two series are equal have to do with the coefficients from an equation?
To check whether the coefficients from two equations are equal, you could check the value of the maximum difference between the two sets of coefficients:Code: Select all
!diff = @max(@abs(eq1.@coef-eq2.@coef))
Eviews Gareth, thanks for your quick reply. You are right, I also confuse by myself now. I need to carefully rethinking what I was doing. Anyway, thank you very much for your help.
Who is online
Users browsing this forum: No registered users and 2 guests
