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!
Can EViews do this? (MatLab can)
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Re: Can EViews do this? (MatLab can)
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.
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
Re: Can EViews do this? (MatLab can)
Thank you
Re: Can EViews do this? (MatLab can)
Is this code correct?, it does not agree with MatLab.
Re: Can EViews do this? (MatLab can)
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...
Who is online
Users browsing this forum: No registered users and 47 guests