Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Log Transformation of Variable


From   Chris Hajzler <[email protected]>
To   [email protected]
Subject   Re: st: Log Transformation of Variable
Date   Mon, 28 Feb 2011 07:57:45 +1300

When you refer to "multiplying" the variable by the listed functions,
do you simply mean you would like to transform that variable by the
specified (nested) function?  If just the simple transformation is
what you want, then your problem is that you have a function of
different functions of the variable, with three transformations of the
variable to be done separately in steps, rather than one single
transformation that is already built into stata.

If I am understanding what it is you are trying to do, you would want
to do something like the following: If y is the variable you would
like to transform,

gen neg_log_y = -log(y)
gen neg_exp_y = -exp(y)
gen transformed_y = neg_log_y + neg_exp_y

Hope this helps.

Chris

On Mon, Feb 28, 2011 at 12:28 AM, Gordon Hughes <[email protected]> wrote:
> It is completely unclear to me - probably other readers - what you are
> trying to do mathematically.  You refer to "multiplying" by (-log -e) but
> log is a function while -log(x)-e is a composite transformation of x.
>  Equally there is no mathematical operator that corresponds to [-log-e](x).
>  Get the mathematics right and Stata can help, but it is not designed to
> sort out nonsense mathematics.
>
> Gordon Hughes
> [email protected]
>
>> ------------------------------
>>
>> Date: Sat, 26 Feb 2011 12:04:48 -0500
>> From: Melissa King <[email protected]>
>> Subject: st: Log Transformation of Variable
>>
>> Good Morning,
>>
>> I have a dataset that I would like to transform by multiplying the
>> dependent variables by -log - e, or in other words, the negative
>> logarithm minus its base. Despite searching this forum and the
>> Internet, I have been unable to find any information on how to "tell"
>> Stata to do this. I am able to transform my variable by multiplying it
>> by negative log:
>>
>> generate transformed_dep_variable = -log(dep_variable)
>>
>> However, Stata errors out when I try to communicate -(log+e), because
>> it no longer recognizes log as a function when I type this in:
>>
>> generate transformed_dep_variable = -(log+e)(dep_variable)
>>
>> Do any long-time Stata users have any suggestions?
>>
>> Thank you in advance for your help!
>>
>> All best,
>>
>> Melissa King
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index