Page 1 of 1

negative values conversion to log

Posted: Sun Aug 09, 2009 9:19 am
by tkuzmin
Hello! I have a problem with a need to convert negative values to log.
I need to make a following transformation: "l(w)=log(1+w) if w>o and l(w)=-log(1-w) when w<0 " but I don't know where and how should I input it?

Re: negative values conversion to log

Posted: Sun Aug 09, 2009 9:22 am
by startz
tkuzmin wrote:Hello! I have a problem with a need to convert negative values to log.
I need to make a following transformation: "l(w)=log(1+w) if w>o and l(w)=-log(1-w) when w<0 " but I don't know where and how should I input it?

Code: Select all

series lw=@recode(w>0,log(1+w),-log(1-w))

Re: negative values conversion to log

Posted: Sun Aug 09, 2009 9:28 am
by tkuzmin
That worked! :) thank you so much for such a fast responce! :)

Re: negative values conversion to log

Posted: Mon Nov 24, 2014 10:16 am
by shan1991
hi i am trying to log this
Variable Coefficient Std. Error t-Statistic Prob.

C -0.607185 0.197008 -3.082031 0.0131
DI -0.074755 0.082380 -0.907445 0.3878
I 0.074791 0.052594 1.422056 0.1887
P 0.872612 0.114900 7.594526 0.0000
U 0.018387 0.030640 0.600093 0.5632

R-squared 0.955490 Mean dependent var 1.127264
Adjusted R-squared 0.935708 S.D. dependent var 2.136854
S.E. of regression 0.541819 Akaike info criterion 1.884683
Sum squared resid 2.642108 Schwarz criterion 2.112917
Log likelihood -8.192779 Hannan-Quinn criter. 1.863555
F-statistic 48.30042 Durbin-Watson stat 1.846996
Prob(F-statistic) 0.000004

via log(g)= c log(di) log(i) log (p) log(u)
but it is telling me that i cant log a negative varible how do i fix it

Re: negative values conversion to log

Posted: Tue Jun 18, 2019 8:41 am
by Fina
startz wrote:
tkuzmin wrote:Hello! I have a problem with a need to convert negative values to log.
I need to make a following transformation: "l(w)=log(1+w) if w>o and l(w)=-log(1-w) when w<0 " but I don't know where and how should I input it?

Code: Select all

series lw=@recode(w>0,log(1+w),-log(1-w))



Hi, do you have justification on the this formula ?

Re: negative values conversion to log

Posted: Tue Jun 18, 2019 9:10 am
by startz
The formula tells how to make OP’s transformation in EViews. No idea why the OP wanted it.

Re: negative values conversion to log

Posted: Sun Jan 12, 2020 9:12 am
by saa
Hello, I have a series that contain both positive and negative numbers, but I need to turn this to Ln.
Can someone please tell me how to proceed?

Re: negative values conversion to log

Posted: Sun Jan 12, 2020 11:03 am
by startz
Don't.

You can't take the log of a negative number.