Generate a sum vector

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

lpando08
Posts: 29
Joined: Tue Apr 03, 2018 1:13 pm

Generate a sum vector

Postby lpando08 » Wed Apr 11, 2018 2:12 pm

Hello, I have run this:

for %c {%grp}
for !j = 1 to var_{%c}.@neqn
vector(!j) ssr_{%c}(!j) = var_{%c}.@ssr(!j)
vector sum_ssr_{%c}(1)=@sum(ssr_{%c})
next
next

where %grp = h dev fixed flex open closed hdebt ldebt

Is there a way to generate a vector like this: ssrt_debt(1)= sum_ssr_ldebt+sum_ssr_hdebt, to sum only the sum_ssr vector for hdebt and for ldebt? I have run this but it doesn't work.

Thank you!

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: Generate a sum vector

Postby EViews Matt » Wed Apr 11, 2018 3:07 pm

Hello,

Code: Select all

vector ssrt_debt = sum_ssr_ldebt + sum_ssr_hdebt

That said, if your sum_ssr_{%c} vectors are only ever going to hold one element, use scalars instead of vectors. And there's no point to calculating sum_ssr_{%c} until after you've finished calculating ssr_{%c}, i.e., move that statement after the inner for loop. Finally, you don't need the "(1)" that's currently in your program.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 29 guests