problems with for loop

For questions regarding programming in the EViews programming language.

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

migaa
Posts: 11
Joined: Mon Apr 04, 2011 8:23 am

problems with for loop

Postby migaa » Tue Mar 08, 2016 11:21 am

Hello,

Would you look through my code, please. the program is not working from this line "equation equ!j.ls u{!j-1} c u!j(-1)". How can I solve this part "u{!j-1}?

Code: Select all

create u 54 series y0=nrnd series a0=nrnd equation eqy0.ls y0 c a0 eqy0.makeresids u0 for !j=1 to 10 equation equ!j.ls u{!j-1} c u!j(-1) series y!j = y{!j-1} -y{!j-1}(-1)*equ!j.@coef(2) series a!j = a{!j-1} -a{!j-1}(-1)*equ!j.@coef(2) smpl @first @first series y!j = y{!j-1}*(1-equ!j.@coef(2)^2)^0.5 series a!j = a{!j-1}*(1-equ!j.@coef(2)^2)^0.5 smpl @all equation eqy!j.ls y!j c a!j eqy!j.makeresids u!j equation equ{!j+1}.ls u!j c u!j(-1) if equ!j.@coef(2) - equ{!j-1}.@coef(2)<0.05 then exitloop endif next
Thanks in advance.

Miga.B
Last edited by migaa on Fri Mar 11, 2016 10:52 am, edited 1 time in total.

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

Re: problems with for loop

Postby EViews Gareth » Tue Mar 08, 2016 11:34 am

Code: Select all

!k = !j-1 equation equ!j.ls u{!k} c u!j(-1)

migaa
Posts: 11
Joined: Mon Apr 04, 2011 8:23 am

Re: problems with for loop

Postby migaa » Tue Mar 08, 2016 8:03 pm

Thank you Gareth. :)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests