How to skip a regression when it has an error
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
How to skip a regression when it has an error
Please see a segment of my program. In the regression equation, it cannot produce coefficients because it has a singular matrix. So tstat(1) gives "division by zero" error and stops the program.
I do this for many equations in a very long program. I need to detect this error and skip to calculate the t-statistics and continue to the other part of program but I cannot do it.
Is there any way of catching that regression didn't produce any estimation and skip it? I hope my explanation is clear. Thanks for your help.
equation eqalum1_12c.ls d(lalum) c ar(1) ma(1) ma(2) dum2 dum3 dum4 dum08Q4
if (@isna(eqalum1_12c.@tstat(1))=0) then
scalar p1_12c = @tdist(eqalum1_12c.@tstat(1), @regobs - eqalum1_12c.@ncoefs)
endif
I do this for many equations in a very long program. I need to detect this error and skip to calculate the t-statistics and continue to the other part of program but I cannot do it.
Is there any way of catching that regression didn't produce any estimation and skip it? I hope my explanation is clear. Thanks for your help.
equation eqalum1_12c.ls d(lalum) c ar(1) ma(1) ma(2) dum2 dum3 dum4 dum08Q4
if (@isna(eqalum1_12c.@tstat(1))=0) then
scalar p1_12c = @tdist(eqalum1_12c.@tstat(1), @regobs - eqalum1_12c.@ncoefs)
endif
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13585
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to skip a regression when it has an error
You can use the @lasterrnum command to catch whether the previous line of a program caused an error or not. Thus something like:
Code: Select all
equation eqalum1_12c.ls d(lalum) c ar(1) ma(1) ma(2) dum2 dum3 dum4 dum08Q4
if @lasterrnum=0 then
'no error caused stuff
else
'error caused stuff
endif
Re: How to skip a regression when it has an error
thanks. Are you sure the spelling is correct because I get this error when I used it
@lasterrnum is an illegal or reserved name
@lasterrnum is an illegal or reserved name
Re: How to skip a regression when it has an error
Actually, I should also point out that the regression line doesn't create any error. Only when i try to use the tstatistics I get an error (division by zero).
Re: How to skip a regression when it has an error
Also, I cannot find this function, @lasterrnum? Where do you go or how do you search? I don't think Eviews help is easy to find anything by simply typing.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13585
- Joined: Tue Sep 16, 2008 5:38 pm
How to skip a regression when it has an error
Which version of EViews?
Re: How to skip a regression when it has an error
Could you respond to my question on what to check without interrupting the program and skip this regression?
Thanks
Thanks
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13585
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to skip a regression when it has an error
EViews 6 doesn't have @lasterrnum.
You can use @errorcount to check how many errors have occurred.
You can use @errorcount to check how many errors have occurred.
Re: How to skip a regression when it has an error
The regression does not have errors. Simply it doesn't converge. So when I try to calculate the t-statistics I get an error. Could you read my earlier messages. I should find a way of detecting that this regression did not do any estimation. I tried @coeff etc but could find a way. when i try t-statistics I get an error of division by zero.
Here is my regression result
WARNING: Singular covariance - coefficients are not unique
MA Backcast: OFF (Roots of MA process too large)
Variable Coefficient Std. Error t-Statistic Prob.
C 0.027287 NA NA NA
DUM2 -0.008653 NA NA NA
DUM3 -0.032919 NA NA NA
DUM4 0.013356 NA NA NA
DUM08Q4 -0.480224 NA NA NA
AR(1) -0.808295 NA NA NA
MA(1) 1.438928 NA NA NA
MA(2) 0.030255 NA NA NA
Here is my regression result
WARNING: Singular covariance - coefficients are not unique
MA Backcast: OFF (Roots of MA process too large)
Variable Coefficient Std. Error t-Statistic Prob.
C 0.027287 NA NA NA
DUM2 -0.008653 NA NA NA
DUM3 -0.032919 NA NA NA
DUM4 0.013356 NA NA NA
DUM08Q4 -0.480224 NA NA NA
AR(1) -0.808295 NA NA NA
MA(1) 1.438928 NA NA NA
MA(2) 0.030255 NA NA NA
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13585
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to skip a regression when it has an error
I read your message. Seems to me that you can just calculate the t-statistic and check whether that calculation caused an error or not.
Of course if you really want to test whether the t-statistic (standard error) is equal to an NA or not, you could just do that.
Of course if you really want to test whether the t-statistic (standard error) is equal to an NA or not, you could just do that.
Re: How to skip a regression when it has an error
That is what I am doing here in the if statement
if (@isna(eqalum1_12c.@tstat(1))=0) then
but I get an error message of division by zero and the program stops.
if (@isna(eqalum1_12c.@tstat(1))=0) then
but I get an error message of division by zero and the program stops.
Last edited by nesheus on Wed Dec 01, 2010 3:45 pm, edited 1 time in total.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13585
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to skip a regression when it has an error
Without running your code it is really hard to know what you're doing wrong.
I've spent an hour giving you three different solutions to your potential problem.
I've spent an hour giving you three different solutions to your potential problem.
Who is online
Users browsing this forum: No registered users and 2 guests
