Evans Jadotte<[email protected]> :
Your desideratum
"How can I transform the Depvar in order to force xb^ to take on
positive values?"
and comments make no sense: N.B. exponentiation preserves rank.
You can make x positive by
su x
replace x=x+2*abs(r(min))
for example, but then you can't take the square root and have it make sense.
Maybe you want
g y=sign(x)*sqrt(abs(x))
or somesuch?
On Thu, Aug 6, 2009 at 12:26 PM, Evans Jadotte<[email protected]> wrote:
> Nick Cox wrote:
>>
>> Exponentiation will get you all positives. After that many options are
>> open.
>>
>> Evans Jadotte wrote:
>>
>>> Nick Cox wrote:
>>>>
>>>> This produces zero or positive values.
>>>>
>>>> Less pedantically, if the variable is already standard normal, why does
>>>> it need transforming?
>>>>
>>>> Nick
>>>>
>>>> Maarten buis wrote:
>>>>
>>>>> --- On Wed, 5/8/09, Evans Jadotte wrote:
>>>>>>
>>>>>> I am trying to run a regression where the dependent
>>>>>> variable has a standard normal distribution (those of you
>>>>>> familiar with the "wealth index based on the PCA analysis",
>>>>>> this is my Depvar). However, I need to have the prediction to be all
>>>>>> positive to use for transforming.
>>>>>> How can I transform the Depvar in order to
>>>>>> force xb^ to take on positive values?
>>>>>
>>>>> Here is one option:
>>>>>
>>>>> reg y x1 x2
>>>>> predict yhat
>>>>> sum yhat, meanonly
>>>>> gen yhatprime = yhat + abs(r(min))
>>>>
>>>> *
>>>> * 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/
>>>
>>> Thanks to Maarten and Nick for their insight and comment on my question.
>>>
>>> I have both negative values and zeros in the /depvar /(/y/)/, /so/ /the
>>> forecast, xb, will reflect such values. And as I will need sqrt(xb) for
>>> further transformation at later stages, I need to transform /y/ so that xb
>>> takes on all 'strictly' positive values and still preserve normality of /y/.
>>> Maarten's suggestion indeed generates a 0 and the transformation I need is
>>> in y (not yhat = xb). I have been trying a Box-Cox power transform but
>>> results are not satisfactory.
>>>
>>
>> *
>> * 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/
>
> Thanks Nick. However, exponentiation will result in a re-ranking of
> individuals, which I must avoid. For instance, someone with a score -5
> compared with one whose score is 4, the former will end up being ranked
> higher than the latter after exponentiating. I need to preserve the ranks
> and normality after transforming.
>
> Thanks for the feedback,
>
> Evans
> *
> * 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/