Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inverse hyperbolic sine transformation

    Hello everyone.
    im actually doing my dissertation.im using aggregate fdi flow as my dependent variable.can someone help me concerning how to transforn data to inverse hyperbolic sine on stata.
    thanks
    Last edited by Lovish shantanoo; 02 Feb 2017, 02:28.

  • #2
    If you type in Stata search inverse hyperbolic sine you will be pointed to the appropriate function.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Code:
      . help asinh()
      
      . di asinh(100)
      5.2983424
      
      . di asinh(-100)
      -5.2983424
      For what I imagine to be your problem, consider also cube roots and the neglog transformation.


      Code:
      gen curt_y = cond(y < 0 , -(-y)^(1/3), y^(1/3)) 
      
      gen neglog_y = sign(y) * log(1 + abs(y))

      Comment


      • #4
        My continuous variable is in levels, and has zero values in 10% of the sample. When I run a OLS for this variable, I have a negative and statistically significant coefficient.

        If I generate "curt_y" as you recommend and then I run a OLS, I found a negative and statistically significant coefficient. On the other hand, when I use "neglog_y", I have the opposite (positive and statistically significant.

        When I add "+1" to each observation that I have in levels, and then transform to natural logs, I found a positive and statistically significant results.

        So Nick Cox what do you suggest to do? And what is the explanation of such completely opposite results?

        Comment


        • #5
          Originally posted by Augusto Mendoza View Post
          what do you suggest to do?
          Code:
          graph twoway scatter level variable
          And what is the explanation of such completely opposite results?
          Ditto. To see what's going on, plot the transformed values against the originals, and against the predictor.

          Comment


          • #6
            Thanks for your feedback, Joseph Coveney

            My "variable" is a binary one. In this link, "graph 1", I plot the transform values [ln(y+1)] vs the original values (y):

            https://drive.google.com/open?id=1lX...Kq_mXKNnq4eXsZ


            In the file "graph 2", I plot the transform values [ln(y+1)] vs[ln(y+1)][ln(y+1)] the predictor:

            https://drive.google.com/open?id=1GQ...REmp37Qn3IW1Y3

            Thanks in advance!

            Comment


            • #7
              Originally posted by Augusto Mendoza View Post
              On the other hand, when I use "neglog_y", I have the opposite (positive and statistically significant.

              When I add "+1" to each observation that I have in levels, and then transform to natural logs, I found a positive and statistically significant results.
              These transformations maintain the same rank order. If you did them correctly, the sign of a predictor's regression coefficient won't flip, not even of a 0/1 indicator variable.
              Code:
              sort level
              generate double neglog_y = sign(level) * log(1 + abs(level))
              assert level > -1
              generate double ln1py = ln(1 + level)
              assert neglog_y >= neglog_y[_n-1] in 2/l
              assert ln1py >= ln1py[_n-1] in 2/l

              Comment

              Working...
              X