Page 1 of 1

how to save coefficients in a table or matrix

Posted: Tue Jul 05, 2022 10:35 am
by Bob
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 ;)

Re: how to save coefficients in a table or matrix

Posted: Tue Jul 05, 2022 12:13 pm
by EViews Gareth
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

Re: how to save coefficients in a table or matrix

Posted: Tue Jul 05, 2022 2:12 pm
by Bob
Thank you very much, amazing, you are really a star!