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

Postby tkuzmin » Sun Aug 09, 2009 9:19 am

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: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: negative values conversion to log

Postby startz » Sun Aug 09, 2009 9:22 am

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

Postby tkuzmin » Sun Aug 09, 2009 9:28 am

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

Postby shan1991 » Mon Nov 24, 2014 10:16 am

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

Postby Fina » Tue Jun 18, 2019 8:41 am

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: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: negative values conversion to log

Postby startz » Tue Jun 18, 2019 9:10 am

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

saa
Posts: 3
Joined: Wed Jan 01, 2020 10:13 am

Re: negative values conversion to log

Postby saa » Sun Jan 12, 2020 9:12 am

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?

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

Re: negative values conversion to log

Postby startz » Sun Jan 12, 2020 11:03 am

Don't.

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


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 27 guests