Log of non positive number

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

FinHons
Posts: 2
Joined: Sun Sep 14, 2014 1:11 am

Log of non positive number

Postby FinHons » Sun Sep 14, 2014 1:16 am

Hi All,

I am getting the error 'Log of non positive number' when attempting to run a regression. My dependent is a log number and 2 of the indepedents are as well but the third is discrete changes. I haven't had this error before and have been running many similar regressions. When I remove the discrete change variable the regression runs fine. I have regressed these variables based on an if statement which places them in the bottom or top decile...the bottom decile regression works fine but the top decile does not. Any suggestions?

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Log of non positive number

Postby startz » Sun Sep 14, 2014 8:03 am

You have zeros or negative numbers in your data. The log of these doesn't exist. You need to decide how you would like these treated.

FinHons
Posts: 2
Joined: Sun Sep 14, 2014 1:11 am

Re: Log of non positive number

Postby FinHons » Sun Sep 14, 2014 8:54 pm

I have already calculated the log changes of the dependent variable and two of the independent variables, the variable which is causing the error message to occur is a discrete change variable. I am not asking eviews to take the log of these numbers as I have pre-organised them into the desired format.

Is it due to how the Newey West AIC lag estimates the regression?

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Log of non positive number

Postby startz » Mon Sep 15, 2014 6:13 am

In that case, what you are seeing is indeed odd. You might want to be sure your copy of EViews is up-to-date. If that doesn't solve the problem, post the EViews workfile together with the offending equation.

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

Re: Log of non positive number

Postby EViews Glenn » Mon Sep 15, 2014 9:55 am

What is your version of EViews? Sounds like it's in a calculation of a summary statistic. Can you post your workfile along with a description of the spec of interest?

JASON
Posts: 10
Joined: Mon Jun 15, 2015 3:24 pm

Re: Log of non positive number

Postby JASON » Mon Jul 06, 2015 9:06 am

Hi,
I have a version 8 EViews.
I am getting an error 'Log of non positive number' while trying to run a regression. My dependent is a log variable and so are the two indepedent variables, as shown below:

Initializing variables
Solving model
Analyzing block structure...
Allocating jacobian...
2009 - Not solved
Log of non positive number in "LOG(RPCETOTPER_JPN) = @COEF(1) + @COEF(2) * LOG(RPCETOTCUR_JPN) + @COEF(3) * LOG(GDPRCAP_JPN) ...

This has occurred after I have made RPCETOTPER RPCETOTCUR take absolute values of their original values, as shown below:

string T_drivers = "etotcur etotcol etotper etotperan etotperda etotperho etotperinp etotperout etotpermg etotpermgdu etotpermgnd"
for %c {s_allcoun}
for %v {T_drivers}
series {%v}{%c} = @ABS({%v}{%c})
NEXT
next

Thanks for your help.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Log of non positive number

Postby EViews Gareth » Mon Jul 06, 2015 9:10 am

That error looks like it is coming from a model object, not a regression.

JASON
Posts: 10
Joined: Mon Jun 15, 2015 3:24 pm

Re: Log of non positive number

Postby JASON » Mon Jul 06, 2015 9:33 am

Hi Gareth,

I agree. This is what I got by clicking "solve" of model M_JPN (see below). Any tip to resolve this issue will be highly appreciated.
Thanks.

Model: M_JPN
Date: 07/06/15 Time: 12:28
Sample: 2009 2015
Solve Options:
Dynamic-Deterministic Simulation
Solver: Broyden
Max iterations = 5000, Convergence = 1e-08

Scenario: Baseline
Solve begin 12:28:08
Solve terminated - Log of non positive number in "LOG(RPCETOTPER_JPN) = @COEF(1) + @COEF(2) * LOG(RPCETOTCUR_JPN) + @COEF(3) ...

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Log of non positive number

Postby startz » Mon Jul 06, 2015 9:35 am

Do you just want

Code: Select all

ls LOG(RPCETOTPER_JPN) c LOG(RPCETOTCUR_JPN) LOG(GDPRCAP_JPN)

JASON
Posts: 10
Joined: Mon Jun 15, 2015 3:24 pm

Re: Log of non positive number

Postby JASON » Mon Jul 06, 2015 10:25 am

Hi Gareth,
Yes, this is the equation:
equation eq_rpcetotper_jpn.ls log(rpcetotper_jpn) c log(rpcetotcur_jpn) log(gdprcap_jpn)

Thanks,
Jing

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Log of non positive number

Postby EViews Gareth » Mon Jul 06, 2015 10:33 am

So the equation estimates fine, it is only when you try to solve a model including the equation that the error occurs?

JASON
Posts: 10
Joined: Mon Jun 15, 2015 3:24 pm

Re: Log of non positive number

Postby JASON » Mon Jul 06, 2015 11:14 am

It looks that way, as you can see the equation estimates below:

Dependent Variable: LOG(RPCETOTPER_JPN)
Method: Least Squares
Date: 07/06/15 Time: 12:27
Sample (adjusted): 1995 2015
Included observations: 21 after adjustments

Variable Coefficient Std. Error t-Statistic Prob.

C -0.274125 0.123241 -2.224297 0.0392
LOG(RPCETOTCUR_JPN) 1.030598 0.010895 94.59269 0.0000
LOG(GDPRCAP_JPN) -0.019491 0.028039 -0.695127 0.4959

R-squared 0.999617 Mean dependent var 12.57879
Adjusted R-squared 0.999574 S.D. dependent var 0.119727
S.E. of regression 0.002471 Akaike info criterion -9.036865
Sum squared resid 0.000110 Schwarz criterion -8.887647
Log likelihood 97.88708 Hannan-Quinn criter. -9.004481
F-statistic 23468.64 Durbin-Watson stat 0.983671
Prob(F-statistic) 0.000000

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Log of non positive number

Postby EViews Gareth » Mon Jul 06, 2015 11:19 am

So all that is happening is that the forecast of that equation involves log of negative numbers.

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Log of non positive number

Postby startz » Mon Jul 06, 2015 11:37 am

So all that is happening is that the forecast of that equation involves log of negative numbers.
But the forecast of that particular equation shouldn't involve logs of negative numbers. Even if the log of the dependent variable is negative, the dependent variable itself should be positive. I wonder if it's something somewhere else in the model?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Log of non positive number

Postby EViews Gareth » Mon Jul 06, 2015 11:55 am

Simply no way of knowing without seeing the workfile.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests