Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: How to find the best transformation for each variable in 120 periods

 From Xixi Lin To statalist@hsphsun2.harvard.edu Subject Re: st: How to find the best transformation for each variable in 120 periods Date Fri, 22 Feb 2013 10:29:11 -0500

```Hi Maarten,

The reason why I wanna transform the variables is that after dropping
missing values and outliers, the residuals are not normal and I want
to use T statistics which requires residuals to be normal if I am not
remembering wrong. I will research on the link function you mentioned.
Thanks a lot.

Best,
Xixi Lin

On Fri, Feb 22, 2013 at 10:03 AM, Maarten Buis <maartenlbuis@gmail.com> wrote:
> To answer that you first need to define what "best" is. This will
> crucially depend on how you want to use those variables and it will
> involve some sort of trade-off and this trade-off will be such that it
> has to be made by humans. So if you are looking for an automatic (or
> automagic) solution than we'll have dissappoint you: no such sollution
> can exist.
>
> Instead you should just inspect your data, and see if there are some
> obvious annomalies, than fit your model of choice, and see if it fits.
> If it does not fit, fix it. This "fixing" may or may not require any
> transformations. Especially, for the
> dependent/explained/left-hand-side/y variable you will want to
> consider using a link function (see: -help glm-) instead of a
> transformation.
>
> -- Maarten
>
> On Fri, Feb 22, 2013 at 3:44 PM, Xixi Lin wrote:
>> Hi,
>>
>> I am trying to find the best transformation for each variable in 120
>> periods. I know that command ladder gives the following result:
>> Transformation          formula         chi2(2)         P(chi2)
>> cubic                           Return^3                .               .
>> square                   Return^2               .               0.000
>> identity                         Return         64.81           0.000
>> square root             sqrt(Return)            .               .
>> log                              log(Return)            .               .
>> 1/(square root)         1/sqrt(Return)          .               .
>> inverse                  1/Return               .               .
>> 1/square                        1/(Return^2)            .               .
>> 1/cubic                 1/(Return^3)            .               .
>>         .
>>  How can I write a loop to find the best transformation fit for each
>> variable in 120 periods if available?
>>
>> Thanks for any help!
>>
>> Best,
>> Xixi Lin
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>
>
>
> --
> ---------------------------------
> Maarten L. Buis
> WZB
> Reichpietschufer 50
> 10785 Berlin
> Germany
>
> http://www.maartenbuis.nl
> ---------------------------------
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```