Page 1 of 2
Log of non positive number
Posted: Sun Sep 14, 2014 1:16 am
by FinHons
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?
Re: Log of non positive number
Posted: Sun Sep 14, 2014 8:03 am
by startz
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.
Re: Log of non positive number
Posted: Sun Sep 14, 2014 8:54 pm
by FinHons
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?
Re: Log of non positive number
Posted: Mon Sep 15, 2014 6:13 am
by startz
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.
Re: Log of non positive number
Posted: Mon Sep 15, 2014 9:55 am
by EViews Glenn
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?
Re: Log of non positive number
Posted: Mon Jul 06, 2015 9:06 am
by JASON
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.
Re: Log of non positive number
Posted: Mon Jul 06, 2015 9:10 am
by EViews Gareth
That error looks like it is coming from a model object, not a regression.
Re: Log of non positive number
Posted: Mon Jul 06, 2015 9:33 am
by JASON
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) ...
Re: Log of non positive number
Posted: Mon Jul 06, 2015 9:35 am
by startz
Do you just want
Code: Select all
ls LOG(RPCETOTPER_JPN) c LOG(RPCETOTCUR_JPN) LOG(GDPRCAP_JPN)
Re: Log of non positive number
Posted: Mon Jul 06, 2015 10:25 am
by JASON
Hi Gareth,
Yes, this is the equation:
equation eq_rpcetotper_jpn.ls log(rpcetotper_jpn) c log(rpcetotcur_jpn) log(gdprcap_jpn)
Thanks,
Jing
Re: Log of non positive number
Posted: Mon Jul 06, 2015 10:33 am
by EViews Gareth
So the equation estimates fine, it is only when you try to solve a model including the equation that the error occurs?
Re: Log of non positive number
Posted: Mon Jul 06, 2015 11:14 am
by JASON
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
Re: Log of non positive number
Posted: Mon Jul 06, 2015 11:19 am
by EViews Gareth
So all that is happening is that the forecast of that equation involves log of negative numbers.
Re: Log of non positive number
Posted: Mon Jul 06, 2015 11:37 am
by startz
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?
Re: Log of non positive number
Posted: Mon Jul 06, 2015 11:55 am
by EViews Gareth
Simply no way of knowing without seeing the workfile.