negative values conversion to log

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

tkuzmin
Posts: 2
Joined: Sun Aug 09, 2009 8:56 am

negative values conversion to log

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?

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

Re: negative values conversion to log

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))

tkuzmin
Posts: 2
Joined: Sun Aug 09, 2009 8:56 am

Re: negative values conversion to log

That worked! thank you so much for such a fast responce! shan1991
Posts: 1
Joined: Mon Nov 24, 2014 10:11 am

Re: negative values conversion to log

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

Fina
Posts: 1
Joined: Tue Jun 18, 2019 7:33 am

Re: negative values conversion to log

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 ?

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

Re: negative values conversion to log

The formula tells how to make OP’s transformation in EViews. No idea why the OP wanted it.