R-squared in my results

For questions regarding programming in the EViews programming language.

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

Zoeltje
Posts: 4
Joined: Sat Mar 08, 2014 11:23 am

R-squared in my results

Postby Zoeltje » Tue Mar 11, 2014 9:18 am

Dear all,

I'm using the following in an Eviews Program:

matrix(3460, 4) results

for !i = 1 to 3460

c(1)=0.1
c(2)=0.00001
c(3)=0.1
c(4)=1.9

equation test.LS(n) RST_DIVC!i*XT_DIVC!i = c(1)+ ((1+EXP(-@abs(C(2))*((c(3)-c(4))*XT_DIVC!i(-3)*(XT_DIVC!i(-1)-(RST_DIVC!i*XT_DIVC!i(-2))))))^-1)*C(3)*XT_DIVC!i(-1)+(1-((1+EXP(-@abs(C(2))*((c(3)-c(4))*XT_DIVC!i(-3)*(XT_DIVC!i(-1)-(RST_DIVC!i*XT_DIVC!i(-2))))))^-1))*C(4)*XT_DIVC!i(-1)

for !j=1 to 4
results(!i, !j) = c(!j)

next
next


But now I not only want to get the coefficients in my results, but also the R-sqaured of each equation (I have 3460 different equations). Does anybody know what I should do? I think I have to use the "@r2", but I don't know how. I tried some things, but they all didn't work.

Thanks in advance!

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: R-squared in my results

Postby EViews Glenn » Tue Mar 11, 2014 10:36 am

I just modified the results matrix to have 5 instead of 4 columns, and added a line at the bottom of the loop to put the r2 inthe 5th column. Note also that I've changed the coefficient references inside the loop to be explicit about their source (equation TEST):

Code: Select all

matrix(3460, 5) results for !i = 1 to 3460 c(1)=0.1 c(2)=0.00001 c(3)=0.1 c(4)=1.9 equation test.LS(n) RST_DIVC!i*XT_DIVC!i = c(1)+ ((1+EXP(-@abs(C(2))*((c(3)-c(4))*XT_DIVC!i(-3)*(XT_DIVC!i(-1)-(RST_DIVC!i*XT_DIVC!i(-2))))))^-1)*C(3)*XT_DIVC!i(-1)+(1-((1+EXP(-@abs(C(2))*((c(3)-c(4))*XT_DIVC!i(-3)*(XT_DIVC!i(-1)-(RST_DIVC!i*XT_DIVC!i(-2))))))^-1))*C(4)*XT_DIVC!i(-1) for !j=1 to 4 results(!i, !j) = test.c(!j) next results(!i, 5) = test.@r2 next

Zoeltje
Posts: 4
Joined: Sat Mar 08, 2014 11:23 am

Re: R-squared in my results

Postby Zoeltje » Tue Mar 11, 2014 11:10 am

Thanks! That works. I only get the message "Equation estimates are invalid or nonexistent in "RESULTS(10, 5) = TEST.@R2" in a 141 times. For those 141 equations the R-squared is zero. Does somebody know what's wrong with those equations?

Thanks in advance.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: R-squared in my results

Postby EViews Glenn » Tue Mar 11, 2014 1:58 pm

If you save an equation each time through the loop, you can look at that equation in isolation after the fact.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests