how to save coefficients in a table or matrix

For questions regarding programming in the EViews programming language.

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

Bob
Posts: 25
Joined: Mon Jan 17, 2022 6:10 am

how to save coefficients in a table or matrix

Postby Bob » Tue Jul 05, 2022 10:35 am

Hello, an idea to save (in a table or matrix) the coefficients resulting from regressions performed in a loop as below. Attention, the number of coefficients may vary because of the seqall method applied to a trend.

for %k …
equation {%k}_lt.breakls(method=seqall) log({%k}) @trend c @nv log(r) log(p_{%k})
next

Thank you for any help ;)

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

Re: how to save coefficients in a table or matrix

Postby EViews Gareth » Tue Jul 05, 2022 12:13 pm

Something like:

Code: Select all

!t = @obsrange
!k = numberofvariables
matrix(!t,!k) res
res=na

!maxcoefs = 1
!i=1
for %k...
   equation {%k}_lt.breakls(method=seqall) log({%k}) @trend c @nv log(r) log(p_{%k})
   if {%k}_lt.@ncoefs > !maxcoefs then
      !maxcoefs = {%k}_lt.@ncoefs
   endif
   matplace(res, {%k}_lt.@coefs, 1, !i)
   !i=!i+1
next
matrix(!maxcoefs, !k) res
Follow us on Twitter @IHSEViews

Bob
Posts: 25
Joined: Mon Jan 17, 2022 6:10 am

Re: how to save coefficients in a table or matrix

Postby Bob » Tue Jul 05, 2022 2:12 pm

Thank you very much, amazing, you are really a star!


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 59 guests