Announcement

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

  • Inverse hyperbolic sine (dep) - linear (independent) transformation

    Hi all,
    I would like to understand the effect of schooling on wealth. I'm using the IHS transformation for wealth as there are lots of negative values. My goal is to understand the effect of one year of school on a % of total wealth & financial wealth.

    Based on Bellemare and Wichman (2020) pg 11, I am using the following code:

    reg asinhtw_mean Z_5 c.distance i.sex_main if mainsample == 1 & !missing(bw_5), robust

    nlcom (exp(_b[Z_5])*xbar*(sqrt(mean_tw2+1))/mean_tw)

    where Z_5 is my explanatory variable of interest, xbar is the mean of Z_5, mean_tw is the mean of total wealth and mean_tw2 is the square of total wealth.

    but I can't run as it says "expression (exp(_b[Z_5])*xbar*(sqrt(mean_tw2+1))/mean_tw) contains reference to X rather than _b[X]"

    My outcome measure is a transformation of the mean of total wealth over a span of five years - not too sure whether is a problem for this estimation.

    Any advice on how to correct this is much appreciated.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(asinhtw mean_tw Z_5 distance sex_main mainsample bw_5 xbar mean_tw2)
    13.157345    278086  10.31255 -19 1 1 0 10.87461  77331824640
    13.343905         .   10.3794 -17 2 0 0 10.87461            .
    12.259613 166433.33 10.526664  -3 2 1 0 10.87461  27700051968
            .         . 10.375663 -13 1 0 0 10.87461            .
     12.32858         .  10.49137  -2 1 0 0 10.87461            .
     12.79599    178713 10.438776  -7 1 1 0 10.87461  31938336768
    12.225875  94583.34 10.516145  -4 2 1 0 10.87461   8946007040
     8.006368      1500 10.375663 -13 1 1 0 10.87461      2250000
    14.724113         . 10.516145  -4 2 0 0 10.87461            .
     8.853665         . 10.358362 -19 2 0 0 10.87461            .
    13.017003         . 10.547702  -1 2 0 0 10.87461            .
    13.818506         . 10.428257  -8 1 0 0 10.87461            .
    13.475878         . 10.516145  -4 2 0 0 10.87461            .
     7.495542      6449 10.400437 -15 2 1 0 10.87461     41589600
    12.810389 185833.33 10.428257  -8 1 1 0 10.87461  34534027264
            0       -20  10.47407  -8 2 1 0 10.87461          400
    12.206073         .  10.48459  -7 2 0 0 10.87461            .
            .         .   10.3967 -11 1 0 0 10.87461            .
     13.19565 270003.34 10.470332  -4 1 1 0 10.87461  7.29018e+10
     13.09273  195815.5 10.375663 -13 1 1 0 10.87461  38343708672
    14.302952         . 10.505627  -5 2 0 0 10.87461            .
    14.085003         .   10.3967 -11 1 0 0 10.87461            .
    12.981565         . 10.410956 -14 2 0 0 10.87461            .
    11.222118     39041 10.344106 -16 1 1 0 10.87461   1524199680
    12.815866    123770 10.344106 -16 1 1 0 10.87461  15319013376
    10.015834         . 10.358362 -19 2 0 0 10.87461            .
    13.053657         . 10.431994 -12 2 0 0 10.87461            .
    10.545341     19000 10.389918 -16 2 1 0 10.87461     3.61e+08
     12.67645         .   10.3794 -17 2 0 0 10.87461            .
      13.0857         . 10.386182 -12 1 0 0 10.87461            .
     13.00313         .   10.3794 -17 2 0 0 10.87461            .
    13.487006         . 10.453032 -10 2 0 0 10.87461            .
    13.217673    293430 10.421475 -13 2 1 0 10.87461  86101164032
    14.108479         . 10.389918 -16 2 0 0 10.87461            .
     12.53449         . 10.516145  -4 2 0 0 10.87461            .
     12.60115 145333.33   10.3967 -11 1 1 0 10.87461  21121775616
    12.693438         .  10.30203 -20 1 0 0 10.87461            .
     12.71289         . 10.421475 -13 2 0 0 10.87461            .
     12.60485     74800 10.431994 -12 2 1 0 10.87461   5595039744
    12.614865    148190 10.354625 -15 1 1 0 10.87461  21960275968
     12.40462         .  10.48085  -3 1 0 0 10.87461            .
    13.265597         . 10.358362 -19 2 0 0 10.87461            .
    12.050354     86540 10.495108  -6 2 1 0 10.87461   7489171456
    13.431376  372423.3 10.344106 -16 1 1 0 10.87461 138699145216
    13.153862 266531.34 10.428257  -8 1 1 0 10.87461  71038959616
    12.876845 250783.77 10.344106 -16 1 1 0 10.87461  6.28925e+10
     14.93327         . 10.442513 -11 2 0 0 10.87461            .
    13.165154 285886.66 10.389918 -16 2 1 0 10.87461  81731182592
    13.572165  396683.3 10.344106 -16 1 1 0 10.87461 157357670400
    13.259715         .  10.50189  -1 1 0 0 10.87461            .
    end
    Many thanks
    Karen

  • #2
    Use -predictnl-, not -nlcom- for this. -nlcom- is for expressions that involve only the coefficients from a model. When data elements are involved, that is what -predictnl- is for.

    Comment


    • #3
      Thank you very much for your help Clyde, this worked!

      predictnl Z_5a = _b[Z_5]*xbar*((sqrt(mean_tw2+1))/mean_tw)

      Many thanks
      Karen

      Comment

      Working...
      X