Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
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 15:04:19 +0000 |
Your sample results pose a deeper problem than your question. Your variable is called -Return- and, at a wild guess, it is a return calculated from time series. I am aware of various related definitions, but if it is true that your flavour of returns may be zero and may be negative, in that case the most commonly used statistically transformations, including logarithmic and square root, are at worst not even defined and best not useful. Putting it another way, why did -ladder- yield a pattern of missing values over most of the display you cite? Independently of that, 1. To find out how to write loops, search for -foreach- and -forval- documentation using -search-. 2. 120 models for 120 periods with possibly different scales for the response [I guess you don't actually mean "each variable"] does not sound a good idea. Nick On Fri, Feb 22, 2013 at 2:44 PM, Xixi Lin <winnielxx@gmail.com> wrote: > 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? * * 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/