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(1w) when w<0 " but I don't know where and how should I input it?
negative values conversion to log
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

 Nonnormality and collinearity are NOT problems!
 Posts: 3550
 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(1w) 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(1w))
Re: negative values conversion to log
That worked! thank you so much for such a fast responce!
Re: negative values conversion to log
hi i am trying to log this
Variable Coefficient Std. Error tStatistic 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
Rsquared 0.955490 Mean dependent var 1.127264
Adjusted Rsquared 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 HannanQuinn criter. 1.863555
Fstatistic 48.30042 DurbinWatson stat 1.846996
Prob(Fstatistic) 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
Variable Coefficient Std. Error tStatistic 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
Rsquared 0.955490 Mean dependent var 1.127264
Adjusted Rsquared 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 HannanQuinn criter. 1.863555
Fstatistic 48.30042 DurbinWatson stat 1.846996
Prob(Fstatistic) 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
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(1w) 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(1w))
Hi, do you have justification on the this formula ?

 Nonnormality and collinearity are NOT problems!
 Posts: 3550
 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.
Re: negative values conversion to log
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?
Can someone please tell me how to proceed?

 Nonnormality and collinearity are NOT problems!
 Posts: 3550
 Joined: Wed Sep 17, 2008 2:25 pm
Re: negative values conversion to log
Don't.
You can't take the log of a negative number.
You can't take the log of a negative number.
Who is online
Users browsing this forum: No registered users and 3 guests