Can EViews do this? (MatLab can)

For questions regarding programming in the EViews programming language.

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

hholtman
Posts: 5
Joined: Wed Nov 26, 2008 4:04 am

Can EViews do this? (MatLab can)

Postby hholtman » Wed Nov 26, 2008 4:18 am

I want to find the polynomial corresponding to given roots, (in order to create a stationary ARMA process).
In MatLab I know you can type poly(x) and this gives you the coefficients of the characteristic polynomial with roots x.
Please help!

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Can EViews do this? (MatLab can)

Postby trubador » Wed Nov 26, 2008 3:38 pm

Dear hholtman,

The following code will do fine. I did not write any comments, since it is a very short piece. However, if you have any further questions you can post it. Besides me, the moderators or other members of the forum may help you improve/modify the code.

Code: Select all

!n=@obs(r)
rowvector(!n+1) b
rowvector(!n+1) bf
b.fill(1) 1
bf.fill(1) 1
for !i = 1 to !n
  for !j =1 to !i
     b(!j+1) = b(!j+1) - r(!i)*bf(!j)
next
bf(!i) = b(!i)
bf(!i+1) = b(!i+1)
next

hholtman
Posts: 5
Joined: Wed Nov 26, 2008 4:04 am

Re: Can EViews do this? (MatLab can)

Postby hholtman » Thu Nov 27, 2008 2:47 am

Thank you :-)

hholtman
Posts: 5
Joined: Wed Nov 26, 2008 4:04 am

Re: Can EViews do this? (MatLab can)

Postby hholtman » Thu Nov 27, 2008 7:27 am

Is this code correct?, it does not agree with MatLab.

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Can EViews do this? (MatLab can)

Postby trubador » Thu Nov 27, 2008 1:13 pm

Yes, the code works perfect actually. However, since EViews cannot handle complex numbers (as far as I know), you will not be able to run it for complex roots, which might be the case in ARMA modeling. If there were any way to specify complex roots, then all you had to do is adding an extra line to the end of the code in order to extract the real part of the final vector (b). Our moderators or other users might have a better idea to overcome this problem...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 13 guests