Announcement

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

  • Log Transformation of Negative Values

    I understand it is not possible to transform my negative values into a log variable which would then lead to missing values. However, I came across this paper

    Busse, M., & Hefeker, C. (2007). Political risk, institutions and foreign direct investment. European journal of political economy, 23(2), 397-415

    It seems like the managed to transform their variables (FDI and Growth) into log variables despite their negative values by using the formula

    Y = ln (X + sqrt(X2+1)) in equation (1) of the paper.

    I did the same thing with my variable and I just want to check with if this makes sense statistically as I do not want my results to be compromised by employing this method (although it worked and I had no missing values)?

    This is the variable I had before and did the log transformation by employing the above method.
    gen lrea = ln(rea+sqrt(rea^2+1))


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double rea float lrea
      39.13813266666667   4.360408
     60.410011999999995   4.794371
      51.08060033333334   4.626648
              62.466026   4.827834
      58.54461133333333   4.763009
     40.808108000000004  4.4021783
      20.17195633333333   3.698054
     12.483683466666667    3.21917
     -.2111375666666667  -.2095995
      .5451751000000004   .5212485
     -37.34087466666667  -4.313415
     -23.72058266666667  -3.859934
    -13.459465066666667  -3.294207
    -12.350081633333332  -3.208445
    -33.336627666666665  -4.200029
     -27.24211366666667  -3.998248
             -23.977575  -3.870701
             -18.353044  -3.603684
             -27.757518 -4.0169783
     -20.14504066666667  -3.696721
             -25.616022  -3.936746
    -26.788110666666668  -3.981454
             -52.681589  -4.657503
     -36.48232166666667 -4.2901626
     -48.39284266666667 -4.5726056
     -65.86139466666667  -4.880757
     -71.29853133333333  -4.960072
             -53.494223  -4.672808
    -41.291238666666665 -4.4139442
             -25.291703  -3.924014
             -25.120687  -3.917235
    -11.800554066666665  -3.163084
     11.860477533333333   3.168131
     3.7127351333333336   2.022578
     -8.790290666666666  -2.870015
      5.500527566666666  2.4061534
               15.59104  3.4408705
     13.602316466666666   3.304736
     2.1667307900000004  1.5158067
     14.136153666666667  3.3431315
     13.700408666666668   3.311902
     -6.543706466666666  -2.577439
    -20.250679666666667 -3.7019446
     -8.576893003333334    -2.8456
      9.022044406666666  2.8958755
     13.382336333333333   3.288476
      5.221383433333333   2.354956
              8.4833935  2.8347135
             -9.1815819  -2.913299
    -19.907728666666667 -3.6848855
     -32.55594233333333  -4.176343
    -20.428037666666665  -3.710654
     -8.793030700000001 -2.8703244
     4.2965170666666666  2.1642275
     -6.222860533333333  -2.527771
    -13.556194533333333 -3.3013484
    -23.626597333333333  -3.855968
            -8.37051217 -2.8214114
    -1.6039786999999996   -1.25109
     23.068966333333332   3.832105
     31.917483333333337  4.1565466
      36.41205033333333  4.2882357
     29.452066666666667  4.0761995
      9.859649666666668    2.98416
    -3.9989844666666663 -2.0944662
     -9.716630499999999 -2.9696236
     -34.44321300000001   -4.23267
    -12.624126133333334  -3.230322
             -4.8125161 -2.2749908
    -15.160078333333333  -3.412899
             -15.143239   -3.41179
    -18.731099999999998  -3.624044
     -35.81994366666667  -4.271847
     -46.57734100000001 -4.5343766
              -59.66092  -4.781895
     -49.17695533333333 -4.5886755
     -56.07041733333333 -4.7198353
    -42.895834666666666  -4.452058
     -36.91814933333333  -4.302034
             -13.267707 -3.2798975
     -5.286501533333333 -2.3671317
      4.948936066666667  2.3023744
      6.775513666666666   2.611864
      8.435973533333334   2.829147
     -2.792858986666667 -1.7508245
             -9.4281721   -2.93965
     -40.64816866666667  -4.398252
    -57.250793666666674  -4.740665
     -45.27946333333333 -4.5061226
    -40.545537333333336  -4.395725
     -38.74795833333334  -4.350392
             -4.0900479 -2.1163242
             10.6210139  3.0581906
      32.22018033333333   4.165981
      39.52709866666667  4.3702936
     102.57146666666665   5.323731
              121.67917   5.494552
              83.438888   5.117298
              94.319298   5.239861
     117.48598333333335   5.459484
    end

  • #2
    "makes sense statistically" sounds good but is hopelessly vague. For what purpose?

    The transformation itself is just a matter of high school mathematics. A graph such as


    Code:
    twoway function ln(x + sqrt(x^2+1)), ra(-100 100) || function asinh(x) , lp(dash) ra(-100 100) legend(order(1 "one thing" 2 "t'other"))
    Click image for larger version

Name:	asinh.png
Views:	1
Size:	18.6 KB
ID:	1482300

    shows that this is a long-winded way to specify asinh(). It's a transformation that pulls in high negative and high positive values alike and maps zeros to zeros. It is often convenient, but whether it is what you want I can't say. I can't see any statement of what you want to do or why transforming values is thought needed or useful (I'm fairly positive about that generally, but you still need a good reason).

    Note that even for positive values this doesn't reduce to logarithms but approximates to log(2 x) for large x.

    Comment

    Working...
    X