Announcement

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

  • listcoef with ivreg2

    Dear Profs and colleagues,

    I need the standard deviation of coefficients so I use listcoef after reg var which works. However when I apply listcoef after ivreg2 it says "listcoef does not work with ivreg2". I believe that there might exist a common /way that is compatible with ivreg2. Any ideas are appreciated.
    Code:
    ivreg2 ln_labor_productivity_w  (hi_nationality  =IV  ) logsize foreign_aff i.year i.sector i.region ltenur lfirmage multi lageworker share_9 share_12 share_uni  ethnic1 ethnic2  ethnic3 ethnic4 ethnic5 ethnic6 ethnic7 ethnic8 , first robust
    Cheers,
    Paris

  • #2
    ivreg2 is from SSC, as you are asked to explain in FAQ Advice #12. If you just need the SDs of variables used by ivreg2, why not just use summarize?

    Code:
    webuse hsng2, clear
    ivreg2 rent pcturban (hsngval = faminc i.region)
    sum `e(depvar)' `e(instd)' `e(insts)' if e(sample), sep(0)
    Res.:

    Code:
    . ivreg2 rent pcturban (hsngval = faminc i.region)
    
    IV (2SLS) estimation
    --------------------
    
    Estimates efficient for homoskedasticity only
    Statistics consistent for homoskedasticity only
    
                                                          Number of obs =       50
                                                          F(  2,    47) =    42.66
                                                          Prob > F      =   0.0000
    Total (centered) SS     =     61243.12                Centered R2   =   0.5989
    Total (uncentered) SS   =      2816856                Uncentered R2 =   0.9913
    Residual SS             =  24565.71669                Root MSE      =    22.17
    
    ------------------------------------------------------------------------------
            rent | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
         hsngval |   .0022398   .0003284     6.82   0.000     .0015961    .0028836
        pcturban |    .081516   .2987652     0.27   0.785     -.504053     .667085
           _cons |   120.7065   15.22839     7.93   0.000     90.85942    150.5536
    ------------------------------------------------------------------------------
    Underidentification test (Anderson canon. corr. LM statistic):          27.364
                                                       Chi-sq(4) P-val =    0.0000
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):               13.298
    Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.85
                                             10% maximal IV relative bias    10.27
                                             20% maximal IV relative bias     6.71
                                             30% maximal IV relative bias     5.34
                                             10% maximal IV size             24.58
                                             15% maximal IV size             13.96
                                             20% maximal IV size             10.26
                                             25% maximal IV size              8.31
    Source: Stock-Yogo (2005).  Reproduced by permission.
    ------------------------------------------------------------------------------
    Sargan statistic (overidentification test of all instruments):          11.288
                                                       Chi-sq(3) P-val =    0.0103
    ------------------------------------------------------------------------------
    Instrumented:         hsngval
    Included instruments: pcturban
    Excluded instruments: faminc 2.region 3.region 4.region
    ------------------------------------------------------------------------------
    
    . 
    . sum `e(depvar)' `e(instd)' `e(insts)' if e(sample), sep(0)
    
        Variable |        Obs        Mean    Std. dev.       Min        Max
    -------------+---------------------------------------------------------
            rent |         50      234.76    35.35335        180        368
         hsngval |         50       48484    15770.24      31100     119400
          faminc |         50    19499.92    2617.218      14591      28395
                 |
          region |
        N Cntrl  |         50         .24    .4314191          0          1
          South  |         50         .32    .4712121          0          1
           West  |         50         .26    .4430875          0          1
                 |
        pcturban |         50    66.94913    14.40956   33.77319   91.29498
    
    .

    Comment


    • #3
      Dear Andrew, Thank you for getting back to me.
      I need SD of coefficients as I asked in #1, not variables.

      Comment


      • #4
        There is no such thing as a standard deviation (SD) of a coefficient. If you run listcoef (part of spost13_ado from https://jslsoc.sitehost.iu.edu/stata), "SDofX" refers to the SD of the variable.

        Code:
        sysuse auto, clear
        regress mpg disp weight
        listcoef
        sum disp weight
        Res.:

        Code:
        .
        . listcoef
        
        regress (N=74): Unstandardized and standardized estimates
        
          Observed SD:  5.7855
          SD of error:  3.4561
        
        -------------------------------------------------------------------------------
                     |         b        t    P>|t|    bStdX    bStdY   bStdXY     SDofX
        -------------+-----------------------------------------------------------------
        displacement |    0.0053    0.535    0.594    0.485    0.001    0.084    91.837
              weight |   -0.0066   -5.631    0.000   -5.104   -0.001   -0.882   777.194
            constant |   40.0845   19.843    0.000        .        .        .         .
        -------------------------------------------------------------------------------
        
        .
        . sum disp weight
        
            Variable |        Obs        Mean    Std. dev.       Min        Max
        -------------+---------------------------------------------------------
        displacement |         74    197.2973    91.83722         79        425
              weight |         74    3019.459    777.1936       1760       4

        Comment


        • #5
          Originally posted by Andrew Musau View Post
          There is no such thing as a standard deviation (SD) of a coefficient.
          Of course it does exit!

          help listcoef
          Code:
          
          Title
          
              listcoef -- Listing regression coefficients with help for interpretation
          
          
          General syntax
          
              listcoef [varlist], [ pvalue(#) [ factor | percent | std ] constant reverse gt lt adjacent positive negative expand nolabel help ]
          
              where varlist contains variables from the regression model for which coefficients are to be listed.
          
          
          Overview
          
              listcoef lists the estimated coefficients for a variety of regression models.
          Moreover, https://stats.oarc.ucla.edu/stata/we...tcoef-command/

          bStdX . These are the regression coefficients with the x-variables (the independent variables) in standard deviations and the y-variable (the dependent variable) in its original units.
          bStdY. These are the regression coefficients with the x-variables (the independent variables) in original units and the y-variable (the dependent variable) in standard deviations.
          bStdXY . These are the regression coefficients with both the x-variable (the independent variable) and the y-variable (the dependent variable) in standard deviations. You will notice that these are the same values given in the Beta column of the regression output.
          SDofX. This is the standard deviation of the x-variables (the dependent variables). I need bStdX

          Comment


          • #6
            Our terminologies differ. You want standardized coefficients and not standard deviations. As listcoef does not support ivreg2, you need to standardize the variables first before running ivreg2. Here is an example that shows you how to do this: #5 https://www.statalist.org/forums/for...s-for-coefplot. If you have missing values, make sure to standardize using the estimation sample.

            Code:
            ivreg2 ...
            foreach var in ... {
                qui sum `var' if e(sample)
                replace `var'= (`var'- r(mean))/r(sd) if e(sample)
            }
            Last edited by Andrew Musau; 03 Jul 2024, 10:32.

            Comment


            • #7
              I have to repeat my question: I would like to obtain coefficients in standard deviations which have been shown in numerous papers with exactly in this term. For not to mislead other users, especially freshmores, please use the term correctly.

              The above code does not give the same result of listcoef

              Code:
              . reg ln_labor_productivity_w  hi_nationality lfirmage logsize foreign_aff multi lageworker ltenur  share_9 share_12 share_uni  ethn
              > ic1 ethnic2  ethnic3 ethnic4 ethnic5 ethnic6 ethnic7 ethnic8 i.year i.sector i.region,  robust
              
              Linear regression                               Number of obs     =  1,461,700
                                                              F(40, 1461659)    =    6497.78
                                                              Prob > F          =     0.0000
                                                              R-squared         =     0.1623
                                                              Root MSE          =      .8202
              
              --------------------------------------------------------------------------------
                             |               Robust
              ln_labor_pro~w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              ---------------+----------------------------------------------------------------
              hi_nationality |  -.0692897   .0027147   -25.52   0.000    -.0746104    -.063969
                    lfirmage |   .0561689   .0007828    71.76   0.000     .0546347    .0577031
                     logsize |   .1640822   .0007768   211.21   0.000     .1625596    .1656048
                 foreign_aff |   .5429106   .0055519    97.79   0.000     .5320289    .5537922
                       multi |  -.0580812    .002438   -23.82   0.000    -.0628595   -.0533028
                  lageworker |  -.0331365   .0031111   -10.65   0.000    -.0392341   -.0270388
                      ltenur |   .0872727   .0028695    30.41   0.000     .0816486    .0928968
                     share_9 |   .1841017   .0035656    51.63   0.000     .1771132    .1910901
                    share_12 |   .4264239   .0039823   107.08   0.000     .4186187    .4342291
                   share_uni |   .7683857   .0048659   157.91   0.000     .7588488    .7779227
                     ethnic1 |  -.5000198    .035822   -13.96   0.000    -.5702297   -.4298099
                     ethnic2 |  -.3399935   .0159652   -21.30   0.000    -.3712847   -.3087022
                     ethnic3 |  -.1982899   .0239308    -8.29   0.000    -.2451934   -.1513865
                     ethnic4 |  -.0865953   .0119784    -7.23   0.000    -.1100727    -.063118
                     ethnic5 |   .1008093    .015535     6.49   0.000     .0703612    .1312575
                     ethnic6 |  -.1584543   .0163181    -9.71   0.000    -.1904372   -.1264715
                     ethnic7 |  -.0187402   .0794657    -0.24   0.814    -.1744902    .1370098
                     ethnic8 |  -.2046155   .0103492   -19.77   0.000    -.2248996   -.1843314
                             |
                        year |
                       2011  |  -.0735184   .0031619   -23.25   0.000    -.0797156   -.0673213
                       2012  |  -.0729002   .0032489   -22.44   0.000     -.079268   -.0665324
                       2013  |  -.0226434   .0032608    -6.94   0.000    -.0290344   -.0162524
                       2014  |  -.0256895   .0032558    -7.89   0.000    -.0320708   -.0193083
                       2015  |  -.0179962   .0031791    -5.66   0.000    -.0242271   -.0117652
                       2016  |   -.010204    .003135    -3.25   0.001    -.0163485   -.0040594
                       2017  |  -.0211848   .0030926    -6.85   0.000    -.0272462   -.0151234
                       2018  |  -.0464156   .0030773   -15.08   0.000     -.052447   -.0403842
                       2019  |  -.0687282     .00308   -22.31   0.000    -.0747649   -.0626914
                             |
                      sector |
                          6  |   .3896998   .0022505   173.16   0.000      .385289    .3941106
                          7  |   .1147885   .0019701    58.27   0.000     .1109272    .1186498
                          9  |  -.4049533   .0025436  -159.21   0.000    -.4099387    -.399968
                         10  |  -.0584985   .0056674   -10.32   0.000    -.0696065   -.0473906
                         11  |   .2246324   .0058465    38.42   0.000     .2131735    .2360913
                         12  |   .0390015   .0031416    12.41   0.000     .0328441     .045159
                         13  |   .0237765    .004052     5.87   0.000     .0158348    .0317181
                             |
                      region |
                          2  |   .0752821   .0017302    43.51   0.000      .071891    .0786731
                          3  |   .1317674   .0019476    67.66   0.000     .1279501    .1355846
                          4  |   .0602823   .0035086    17.18   0.000     .0534056     .067159
                          5  |   .0584914   .0031386    18.64   0.000     .0523397     .064643
                          6  |   .0951132   .0056546    16.82   0.000     .0840303    .1061961
                          7  |  -.0051662   .0053328    -0.97   0.333    -.0156184    .0052859
                             |
                       _cons |   8.733179   .0117687   742.07   0.000     8.710113    8.756246
              --------------------------------------------------------------------------------
              
              .
              end of do-file
              
              . do "C:\Users\CeBER\AppData\Local\Temp\STD24c0_000000.tmp"
              
              . listcoef hi_nationality lfirmage logsize foreign_aff multi lageworker ltenur  share_9 share_12 share_uni  ethnic1 ethnic2  ethnic3
              >  ethnic4 ethnic5 ethnic6 ethnic7 ethnic8
              
              regress (N=1461700): Unstandardized and standardized estimates
              
                Observed SD:  0.8961
                SD of error:  0.8202
              
              -------------------------------------------------------------------------------
                           |         b        t    P>|t|    bStdX    bStdY   bStdXY     SDofX
              -------------+-----------------------------------------------------------------
              hi_nationa~y |   -0.0693  -25.524    0.000   -0.019   -0.077   -0.022     0.279
                  lfirmage |    0.0562   71.758    0.000    0.058    0.063    0.064     1.024
                   logsize |    0.1641  211.215    0.000    0.180    0.183    0.201     1.099
               foreign_aff |    0.5429   97.787    0.000    0.079    0.606    0.088     0.145
                     multi |   -0.0581  -23.824    0.000   -0.015   -0.065   -0.017     0.265
                lageworker |   -0.0331  -10.651    0.000   -0.008   -0.037   -0.009     0.255
                    ltenur |    0.0873   30.414    0.000    0.033    0.097    0.037     0.375
                   share_9 |    0.1841   51.633    0.000    0.069    0.205    0.077     0.377
                  share_12 |    0.4264  107.080    0.000    0.140    0.476    0.156     0.329
                 share_uni |    0.7684  157.913    0.000    0.231    0.857    0.257     0.300
                   ethnic1 |   -0.5000  -13.958    0.000   -0.012   -0.558   -0.014     0.025
                   ethnic2 |   -0.3400  -21.296    0.000   -0.017   -0.379   -0.019     0.049
                   ethnic3 |   -0.1983   -8.286    0.000   -0.007   -0.221   -0.007     0.034
                   ethnic4 |   -0.0866   -7.229    0.000   -0.006   -0.097   -0.007     0.069
                   ethnic5 |    0.1008    6.489    0.000    0.006    0.112    0.007     0.059
                   ethnic6 |   -0.1585   -9.710    0.000   -0.008   -0.177   -0.009     0.053
                   ethnic7 |   -0.0187   -0.236    0.814   -0.000   -0.021   -0.000     0.012
                   ethnic8 |   -0.2046  -19.771    0.000   -0.017   -0.228   -0.019     0.084
              -------------------------------------------------------------------------------
              So based on the above code the coefficient of hi_natioanlity must be -0.019

              Code:
              . foreach var in  ln_labor_productivity_w  hi_nationality lfirmage logsize foreign_aff multi lageworker ltenur  share_9 share_12 sha
              > re_uni  ethnic1 ethnic2  ethnic3 ethnic4 ethnic5 ethnic6 ethnic7 ethnic8 {
                2.     qui sum `var'
                3.     replace `var'= (`var'- r(mean))/r(sd)
                4. }
              (2,309,140 real changes made)
              (1,544,719 real changes made)
              (1,461,700 real changes made)
              (1,544,719 real changes made)
              (2,309,140 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              (1,544,719 real changes made)
              
              . regress ln_labor_productivity_w  hi_nationality lfirmage logsize foreign_aff multi lageworker ltenur  share_9 share_12 share_uni  
              > ethnic1 ethnic2  ethnic3 ethnic4 ethnic5 ethnic6 ethnic7 ethnic8 i.year i.sector i.region,  robust
              
              Linear regression                               Number of obs     =  1,461,700
                                                              F(40, 1461659)    =    6497.78
                                                              Prob > F          =     0.0000
                                                              R-squared         =     0.1623
                                                              Root MSE          =     .72388
              
              --------------------------------------------------------------------------------
                             |               Robust
              ln_labor_pro~w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              ---------------+----------------------------------------------------------------
              hi_nationality |  -.0170773   .0006691   -25.52   0.000    -.0183887   -.0157659
                    lfirmage |   .0507489   .0007072    71.76   0.000     .0493628     .052135
                     logsize |   .1588333    .000752   211.21   0.000     .1573594    .1603072
                 foreign_aff |   .0647823   .0006625    97.79   0.000     .0634839    .0660808
                       multi |  -.0134323   .0005638   -23.82   0.000    -.0145374   -.0123272
                  lageworker |  -.0075215   .0007062   -10.65   0.000    -.0089056   -.0061374
                      ltenur |   .0295718   .0009723    30.41   0.000     .0276661    .0314775
                     share_9 |   .0614998   .0011911    51.63   0.000     .0591653    .0638343
                    share_12 |   .1246938   .0011645   107.08   0.000     .1224114    .1269761
                   share_uni |   .2044285   .0012946   157.91   0.000     .2018912    .2069658
                     ethnic1 |  -.0114241   .0008184   -13.96   0.000    -.0130283     -.00982
                     ethnic2 |  -.0152237   .0007149   -21.30   0.000    -.0166248   -.0138226
                     ethnic3 |  -.0060353   .0007284    -8.29   0.000    -.0074629   -.0046077
                     ethnic4 |  -.0054209   .0007498    -7.23   0.000    -.0068905   -.0039512
                     ethnic5 |   .0053514   .0008247     6.49   0.000      .003735    .0069677
                     ethnic6 |  -.0076401   .0007868    -9.71   0.000    -.0091822    -.006098
                     ethnic7 |  -.0001969    .000835    -0.24   0.814    -.0018335    .0014397
                     ethnic8 |  -.0158865   .0008035   -19.77   0.000    -.0174614   -.0143117
                             |
                        year |
                       2011  |  -.0648847   .0027905   -23.25   0.000    -.0703541   -.0594153
                       2012  |  -.0643391   .0028674   -22.44   0.000    -.0699591   -.0587191
                       2013  |  -.0199843   .0028778    -6.94   0.000    -.0256247   -.0143438
                       2014  |  -.0226727   .0028734    -7.89   0.000    -.0283045   -.0170408
                       2015  |  -.0158828   .0028058    -5.66   0.000     -.021382   -.0103836
                       2016  |  -.0090057   .0027669    -3.25   0.001    -.0144286   -.0035827
                       2017  |  -.0186969   .0027294    -6.85   0.000    -.0240465   -.0133473
                       2018  |  -.0409647   .0027159   -15.08   0.000    -.0462878   -.0356416
                       2019  |   -.060657   .0027183   -22.31   0.000    -.0659848   -.0553292
                             |
                      sector |
                          6  |   .3439351   .0019862   173.16   0.000     .3400422    .3478279
                          7  |   .1013082   .0017387    58.27   0.000     .0979004    .1047161
                          9  |  -.3573973   .0022449  -159.21   0.000    -.3617972   -.3529975
                         10  |  -.0516287   .0050019   -10.32   0.000    -.0614322   -.0418252
                         11  |   .1982525   .0051599    38.42   0.000     .1881393    .2083658
                         12  |   .0344214   .0027727    12.41   0.000      .028987    .0398557
                         13  |   .0209843   .0035761     5.87   0.000     .0139752    .0279933
                             |
                      region |
                          2  |   .0664413    .001527    43.51   0.000     .0634484    .0694341
                          3  |   .1162932   .0017189    67.66   0.000     .1129242    .1196621
                          4  |    .053203   .0030965    17.18   0.000     .0471339    .0592721
                          5  |   .0516224   .0027701    18.64   0.000     .0461932    .0570516
                          6  |   .0839435   .0049906    16.82   0.000     .0741621    .0937249
                          7  |  -.0045595   .0047066    -0.97   0.333    -.0137843    .0046652
                             |
                       _cons |     .08606   .0025113    34.27   0.000     .0811379    .0909821
              --------------------------------------------------------------------------------
              But it is -.017

              Comment


              • #8
                I would agree to "coefficients in standard deviations", implying that their units are standard deviations. But they are still coefficients. We also call them standardized coefficients. On your question, see my comment in #6 with regards to using the estimation sample to standardize. Post again if the results do not match.

                Comment


                • #9
                  Still, do not match.
                  Code:
                   foreach var in ln_labor_productivity_w hi_nationality lfirmage logsize foreign_aff multi lageworker ltenur  share_9 share_12 share
                  > _uni ethnic1 ethnic2  ethnic3 ethnic4 ethnic5 ethnic6 ethnic7 ethnic8  {
                    2.     qui sum `var' if e(sample)
                    3.     replace `var'= (`var'- r(mean))/r(sd) if e(sample)
                    4. }
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  (1,461,700 real changes made)
                  
                  . regress ln_labor_productivity_w  hi_nationality lfirmage logsize foreign_aff multi lageworker ltenur  share_9 share_12 share_uni  
                  > ethnic1 ethnic2  ethnic3 ethnic4 ethnic5 ethnic6 ethnic7 ethnic8 i.year i.sector i.region,  robust
                  
                  Linear regression                               Number of obs     =  1,461,700
                                                                  F(40, 1461659)    =    6497.78
                                                                  Prob > F          =     0.0000
                                                                  R-squared         =     0.1623
                                                                  Root MSE          =     .91528
                  
                  --------------------------------------------------------------------------------
                                 |               Robust
                  ln_labor_pro~w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  ---------------+----------------------------------------------------------------
                  hi_nationality |  -.0215514   .0008444   -25.52   0.000    -.0232064   -.0198965
                        lfirmage |   .0641674   .0008942    71.76   0.000     .0624148      .06592
                         logsize |   .2011429   .0009523   211.21   0.000     .1992764    .2030094
                     foreign_aff |   .0880744   .0009007    97.79   0.000     .0863091    .0898397
                           multi |  -.0171896   .0007215   -23.82   0.000    -.0186038   -.0157755
                      lageworker |  -.0094346   .0008858   -10.65   0.000    -.0111707   -.0076984
                          ltenur |   .0365032   .0012002    30.41   0.000     .0341508    .0388555
                         share_9 |   .0773618   .0014983    51.63   0.000     .0744252    .0802984
                        share_12 |   .1564179   .0014608   107.08   0.000     .1535549    .1592809
                       share_uni |   .2573769   .0016299   157.91   0.000     .2541824    .2605714
                         ethnic1 |  -.0138556   .0009926   -13.96   0.000    -.0158011   -.0119101
                         ethnic2 |  -.0186202   .0008744   -21.30   0.000    -.0203339   -.0169064
                         ethnic3 |  -.0074314   .0008969    -8.29   0.000    -.0091892   -.0056735
                         ethnic4 |   -.006686   .0009249    -7.23   0.000    -.0084987   -.0048733
                         ethnic5 |   .0065945   .0010162     6.49   0.000     .0046027    .0085863
                         ethnic6 |  -.0094248   .0009706    -9.71   0.000    -.0113271   -.0075225
                         ethnic7 |  -.0002413   .0010234    -0.24   0.814    -.0022471    .0017644
                         ethnic8 |  -.0191722   .0009697   -19.77   0.000    -.0210728   -.0172716
                                 |
                            year |
                           2011  |  -.0820409   .0035284   -23.25   0.000    -.0889564   -.0751253
                           2012  |   -.081351   .0036256   -22.44   0.000     -.088457    -.074245
                           2013  |  -.0252683   .0036388    -6.94   0.000    -.0324002   -.0181365
                           2014  |  -.0286675   .0036332    -7.89   0.000    -.0357885   -.0215466
                           2015  |  -.0200823   .0035476    -5.66   0.000    -.0270356   -.0131291
                           2016  |  -.0113868   .0034984    -3.25   0.001    -.0182436     -.00453
                           2017  |  -.0236406   .0034511    -6.85   0.000    -.0304047   -.0168765
                           2018  |  -.0517962    .003434   -15.08   0.000    -.0585268   -.0450656
                           2019  |  -.0766953   .0034371   -22.31   0.000    -.0834319   -.0699588
                                 |
                          sector |
                              6  |    .434875   .0025113   173.16   0.000     .4299528    .4397971
                              7  |   .1280952   .0021985    58.27   0.000     .1237862    .1324041
                              9  |  -.4518968   .0028384  -159.21   0.000      -.45746   -.4463335
                             10  |  -.0652799   .0063244   -10.32   0.000    -.0776755   -.0528842
                             11  |   .2506725   .0065242    38.42   0.000     .2378852    .2634598
                             12  |   .0435227   .0035058    12.41   0.000     .0366515    .0503939
                             13  |   .0265327   .0045217     5.87   0.000     .0176704     .035395
                                 |
                          region |
                              2  |    .084009   .0019307    43.51   0.000     .0802248    .0877932
                              3  |   .1470422   .0021734    67.66   0.000     .1427824     .151302
                              4  |   .0672704   .0039153    17.18   0.000     .0595966    .0749443
                              5  |   .0652719   .0035025    18.64   0.000     .0584071    .0721366
                              6  |    .106139   .0063101    16.82   0.000     .0937713    .1185067
                              7  |  -.0057651    .005951    -0.97   0.333     -.017429    .0058987
                                 |
                           _cons |  -.0879333   .0031711   -27.73   0.000    -.0941485    -.081718
                  --------------------------------------------------------------------------------

                  Comment


                  • #10
                    Reduce the number of variables and observations and find a subsample that reproduces the issue. Then provide a dataex example of this subsample.

                    Comment


                    • #11
                      Code:
                      clear
                      input float(ln_labor_productivity_w hi_nationality)
                       9.281988 .9923468
                       9.333387 .9915874
                        8.76686 .9959396
                      10.198627 .9926839
                       9.510689 .9909202
                       8.791356   .99805
                      10.330937 .9905199
                       9.590218 .9978104
                      10.110822 .9940464
                       9.637493 .9989997
                        9.69247  .995016
                       9.546683 .9903305
                       8.837241 .9992133
                        8.22231 .9952798
                       9.584678 .9944996
                       8.645433 .9975001
                       9.868996 .9953218
                      10.096255 .9922356
                       9.187426 .9972121
                       8.821714 .9942925
                        10.3666 .9971483
                       9.302102 .9982308
                       8.239303 .9930201
                       9.406878 .9906753
                       9.532752  .994872
                       9.996658 .9967926
                       8.682385 .9977748
                       8.732817 .9961808
                       8.695457 .9961513
                       8.513886 .9924938
                      10.130157 .9904519
                       9.382533 .9930528
                       8.517624 .9947981
                      10.396965 .9931585
                      8.9895525 .9984176
                       8.781916 .9976585
                       8.876676  .998732
                       9.336425 .9915495
                       9.252281  .998728
                      10.703698 .9911469
                       9.224909 .9938857
                       9.494924 .9900637
                       9.044812 .9986701
                       9.090109 .9957239
                       9.526831 .9927593
                       8.741158 .9900004
                       8.975822 .9976693
                       9.646744 .9943078
                       9.582047 .9962072
                       8.703842 .9966113
                        9.44824 .9953623
                       9.600907 .9952037
                       8.733271 .9964204
                       9.358811 .9968798
                      9.1950245 .9913253
                       8.698541 .9943939
                      9.1031475 .9957154
                       8.942465 .9985592
                       8.422465 .9935536
                       9.357276 .9985983
                       9.093091 .9911243
                       8.673805 .9924456
                        10.7588 .9911495
                        8.94105 .9969143
                       9.669009 .9936522
                       8.645086 .9960824
                       9.706211 .9911944
                       8.966554 .9913761
                       9.657453 .9925055
                       9.553917 .9961549
                       9.505138 .9934007
                       9.144127 .9939017
                        8.71483  .990463
                       8.838542 .9961025
                      10.076946 .9914981
                       9.047061 .9941899
                       9.340981  .990203
                       9.635928 .9945736
                       8.226807 .9903846
                       9.242423 .9924413
                      end

                      It must be -0.143 though it is -.252


                      Code:
                       reg ln_labor_productivity_w  hi_nationality
                      
                            Source |       SS           df       MS      Number of obs   =        80
                      -------------+----------------------------------   F(1, 78)        =      5.33
                             Model |  1.61857633         1  1.61857633   Prob > F        =    0.0236
                          Residual |  23.6964161        78  .303800206   R-squared       =    0.0639
                      -------------+----------------------------------   Adj R-squared   =    0.0519
                             Total |  25.3149924        79  .320442942   Root MSE        =    .55118
                      
                      --------------------------------------------------------------------------------
                      ln_labor_pro~w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ---------------+----------------------------------------------------------------
                      hi_nationality |  -52.50897   22.74893    -2.31   0.024    -97.79861   -7.219333
                               _cons |   61.49565    22.6229     2.72   0.008     16.45691    106.5344
                      --------------------------------------------------------------------------------
                      
                      . listcoef hi_nationality
                      
                      regress (N=80): Unstandardized and standardized estimates 
                      
                        Observed SD:  0.5661
                        SD of error:  0.5512
                      
                      -------------------------------------------------------------------------------
                                   |         b        t    P>|t|    bStdX    bStdY   bStdXY     SDofX
                      -------------+-----------------------------------------------------------------
                      hi_nationa~y |  -52.5090   -2.308    0.024   -0.143  -92.759   -0.253     0.003
                      -------------------------------------------------------------------------------
                      
                      . preserve
                      already preserved
                      r(621);
                      
                      . foreach var in ln_labor_productivity_w hi_nationality  {
                        2. 
                      .     qui sum `var' if e(sample)
                        3. 
                      .     replace `var'= (`var'- r(mean))/r(sd) if e(sample)
                        4. 
                      . }
                      (80 real changes made)
                      (80 real changes made)
                      
                      . reg ln_labor_productivity_w  hi_nationality
                      
                            Source |       SS           df       MS      Number of obs   =        80
                      -------------+----------------------------------   F(1, 78)        =      5.33
                             Model |  5.05105959         1  5.05105959   Prob > F        =    0.0236
                          Residual |  73.9489399        78  .948063332   R-squared       =    0.0639
                      -------------+----------------------------------   Adj R-squared   =    0.0519
                             Total |  78.9999995        79  .999999993   Root MSE        =    .97369
                      
                      --------------------------------------------------------------------------------
                      ln_labor_pro~w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ---------------+----------------------------------------------------------------
                      hi_nationality |  -.2528586   .1095482    -2.31   0.024    -.4709522   -.0347649
                               _cons |   4.69e-09   .1088613     0.00   1.000    -.2167263    .2167263
                      --------------------------------------------------------------------------------

                      Comment


                      • #12
                        "X" in bStd[X|Y|XY] refers to the vector of RHS variables and "Y" is the outcome. Indeed, your standardized coefficient does match "bStdXY". For what you want, just standardize the RHS variables.

                        Code:
                        clear
                        input float(ln_labor_productivity_w hi_nationality)
                         9.281988 .9923468
                         9.333387 .9915874
                          8.76686 .9959396
                        10.198627 .9926839
                         9.510689 .9909202
                         8.791356   .99805
                        10.330937 .9905199
                         9.590218 .9978104
                        10.110822 .9940464
                         9.637493 .9989997
                          9.69247  .995016
                         9.546683 .9903305
                         8.837241 .9992133
                          8.22231 .9952798
                         9.584678 .9944996
                         8.645433 .9975001
                         9.868996 .9953218
                        10.096255 .9922356
                         9.187426 .9972121
                         8.821714 .9942925
                          10.3666 .9971483
                         9.302102 .9982308
                         8.239303 .9930201
                         9.406878 .9906753
                         9.532752  .994872
                         9.996658 .9967926
                         8.682385 .9977748
                         8.732817 .9961808
                         8.695457 .9961513
                         8.513886 .9924938
                        10.130157 .9904519
                         9.382533 .9930528
                         8.517624 .9947981
                        10.396965 .9931585
                        8.9895525 .9984176
                         8.781916 .9976585
                         8.876676  .998732
                         9.336425 .9915495
                         9.252281  .998728
                        10.703698 .9911469
                         9.224909 .9938857
                         9.494924 .9900637
                         9.044812 .9986701
                         9.090109 .9957239
                         9.526831 .9927593
                         8.741158 .9900004
                         8.975822 .9976693
                         9.646744 .9943078
                         9.582047 .9962072
                         8.703842 .9966113
                          9.44824 .9953623
                         9.600907 .9952037
                         8.733271 .9964204
                         9.358811 .9968798
                        9.1950245 .9913253
                         8.698541 .9943939
                        9.1031475 .9957154
                         8.942465 .9985592
                         8.422465 .9935536
                         9.357276 .9985983
                         9.093091 .9911243
                         8.673805 .9924456
                          10.7588 .9911495
                          8.94105 .9969143
                         9.669009 .9936522
                         8.645086 .9960824
                         9.706211 .9911944
                         8.966554 .9913761
                         9.657453 .9925055
                         9.553917 .9961549
                         9.505138 .9934007
                         9.144127 .9939017
                          8.71483  .990463
                         8.838542 .9961025
                        10.076946 .9914981
                         9.047061 .9941899
                         9.340981  .990203
                         9.635928 .9945736
                         8.226807 .9903846
                         9.242423 .9924413
                        end
                        
                        qui reg ln_labor_productivity_w  hi_nationality
                        foreach var in  hi_nationality  {
                          qui sum `var' if e(sample)
                          replace `var'= (`var'- r(mean))/r(sd) if e(sample)
                        }
                        reg ln_labor_productivity_w  hi_nationality
                        Res.:

                        Code:
                        . qui reg ln_labor_productivity_w  hi_nationality
                        
                        .
                        . foreach var in  hi_nationality  {
                          2.
                        .   qui sum `var' if e(sample)
                          3.
                        .   replace `var'= (`var'- r(mean))/r(sd) if e(sample)
                          4.
                        . }
                        (80 real changes made)
                        
                        .
                        . reg ln_labor_productivity_w  hi_nationality
                        
                              Source |       SS           df       MS      Number of obs   =        80
                        -------------+----------------------------------   F(1, 78)        =      5.33
                               Model |  1.61859692         1  1.61859692   Prob > F        =    0.0236
                            Residual |  23.6963981        78  .303799976   R-squared       =    0.0639
                        -------------+----------------------------------   Adj R-squared   =    0.0519
                               Total |  25.3149951        79  .320442976   Root MSE        =    .55118
                        
                        --------------------------------------------------------------------------------
                        ln_labor_pro~w | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                        ---------------+----------------------------------------------------------------
                        hi_nationality |  -.1431383   .0620127    -2.31   0.024     -.266596   -.0196806
                                 _cons |   9.277767   .0616239   150.55   0.000     9.155083    9.400451
                        --------------------------------------------------------------------------------

                        Comment


                        • #13
                          That's correct! Only RHS works. Thank you so much.

                          Comment

                          Working...
                          X