Save Var results in a scalar, matrix,etc.

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

Save Var results in a scalar, matrix,etc.

Postby lpando08 » Thu Apr 05, 2018 1:46 pm

Hi everyone!

I have run a VAR and I would like to know if there is exist a way to save the results, exactly the sum of squared residuals that appears in the window of VAR estimation outputs. I want to save that number in a scalar or matrix. Is there a command or a way to do this?

Thank you for your answers!

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

Re: Save Var results in a scalar, matrix,etc.

Postby EViews Matt » Thu Apr 05, 2018 1:59 pm

Hello,

Take a look at the VAR object documentation. I believe the @ssr data member is what you're looking for.

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

Re: Save Var results in a scalar, matrix,etc.

Postby lpando08 » Thu Apr 05, 2018 2:04 pm

Hi, yes. I have tried to used it but I cant, do yo have any example where I can use this command running a VAR? I tried to used this commad after running the VAR but the programm says that there is no a equation especified.

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

Re: Save Var results in a scalar, matrix,etc.

Postby EViews Matt » Thu Apr 05, 2018 2:56 pm

You need to specify which VAR equation's SSR you want, e.g., @ssr(1), @ssr(2), etc.

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

Re: Save Var results in a scalar, matrix,etc.

Postby lpando08 » Thu Apr 05, 2018 3:12 pm

Only a last question please, if I have 2 vars: var 1 and var2, the first with 3 equations and the second with 4. Is there any way to save the total ssr generated, I mean in this case to save the seven ssr that would be generated? and then to find the minimun of them?

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

Re: Save Var results in a scalar, matrix,etc.

Postby EViews Matt » Thu Apr 05, 2018 3:30 pm

Sure, a few loops can easily go through any number of VARs you wish with any number of equations per VAR:

Code: Select all

!k = 1
for %v var1 var2
   for !i = 1 to {%v}.@neqn
      vector(!k) ssr(!k) = {%v}.@ssr(!i)
      !k = !k + 1
   next
next
scalar min_ssr = @mins(ssr, 1)

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

Re: Save Var results in a scalar, matrix,etc.

Postby lpando08 » Thu Apr 05, 2018 4:38 pm

Hello, thank you very much for your answer but I think I made a mistake and this was not what I was looking for :(. Actually, I have this a var_{%grp} that goes from var_1 to var_n, each of them have différent number of équations. What I want to do is for each équation of each var ( from var_1 to var_n) save the ssr’s and then for each var find the minimun ssr. I mean have the minimun ssr for each var.

Thank you very much for your answer!

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

Re: Save Var results in a scalar, matrix,etc.

Postby EViews Matt » Fri Apr 06, 2018 8:48 am

Something like this...

Code: Select all

!m = 1
for !i = 1 to <fill in n>
   !k = 1
   for !j = 1 to var_!i.@neqn
      vector(!k) ssr(!k) = var_!i.@ssr(!j)
      !k = !k + 1
   next
   !tmp = @mins(ssr, 1)
   vector(!m) min_ssr(!m) = !tmp
   !m = !m + 1
next

The minimum SSRs are stored in vector min_ssr.

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

Re: Save Var results in a scalar, matrix,etc.

Postby lpando08 » Sat Apr 07, 2018 9:31 pm

Thank you very much!


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 26 guests