Announcement

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

  • sem or 95%CI for X-standardized coefficient?

    Hello,

    I am using Stata v 15.1
    After running a logistic regression
    . logit y x
    I used the syntax:
    . listcoef, std help

    it returns output for full, X, and Y standardized estimates with the definition of "bStdX = x-standardized coefficient". In a Stata example, this was 1.319. However, there is no info about how to obtain the standard error or 95% confidence intervals. I tried something from a Nov 2015 thread
    . stdbeta,se
    but this returns a comment that stdbeta is an "unrecognized command"
    Dos anyone have syntax to get the sem or 95% CI for an X-standardized coefficient?

    Thank you,
    Sharon

  • #2
    For those who don't know, listcoef is part of spost13_ado (findit spost13_ado).

    The simplest way may be to do the X standardization yourself.

    Code:
    . webuse nhanes2f, clear
    
    . logit diabetes weight height, nolog
    
    Logistic regression                             Number of obs     =     10,335
                                                    LR chi2(2)        =     130.28
                                                    Prob > chi2       =     0.0000
    Log likelihood = -1933.9288                     Pseudo R2         =     0.0326
    
    ------------------------------------------------------------------------------
        diabetes |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          weight |   .0301604   .0028288    10.66   0.000     .0246161    .0357048
          height |  -.0473011   .0052236    -9.06   0.000    -.0575391   -.0370631
           _cons |   2.671749   .8062233     3.31   0.001      1.09158    4.251917
    ------------------------------------------------------------------------------
    
    . egen xweight = std(weight) if e(sample)
    (2 missing values generated)
    
    . egen xheight = std(height) if e(sample)
    (2 missing values generated)
    
    . logit diabetes xweight xheight,nolog
    
    Logistic regression                             Number of obs     =     10,335
                                                    LR chi2(2)        =     130.28
                                                    Prob > chi2       =     0.0000
    Log likelihood = -1933.9288                     Pseudo R2         =     0.0326
    
    ------------------------------------------------------------------------------
        diabetes |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         xweight |   .4631369   .0434386    10.66   0.000     .3779987    .5482751
         xheight |  -.4569181   .0504586    -9.06   0.000    -.5558151   -.3580211
           _cons |  -3.089788   .0499536   -61.85   0.000    -3.187695   -2.991881
    ------------------------------------------------------------------------------
    Harder ways (which I might skip if I hadn't done them first!). To get stdbeta,

    Code:
    findit stdbeta   (install the program)
    Then,

    Code:
    . webuse nhanes2f, clear
    
    . logit diabetes weight height,nolog
    
    Logistic regression                             Number of obs     =     10,335
                                                    LR chi2(2)        =     130.28
                                                    Prob > chi2       =     0.0000
    Log likelihood = -1933.9288                     Pseudo R2         =     0.0326
    
    ------------------------------------------------------------------------------
        diabetes |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          weight |   .0301604   .0028288    10.66   0.000     .0246161    .0357048
          height |  -.0473011   .0052236    -9.06   0.000    -.0575391   -.0370631
           _cons |   2.671749   .8062233     3.31   0.001      1.09158    4.251917
    ------------------------------------------------------------------------------
    
    . listcoef, std
    
    logit (N=10335): Unstandardized and standardized estimates
    
      Observed SD:  0.2144
        Latent SD:  1.8738
    
    -------------------------------------------------------------------------------
                 |         b        z    P>|z|    bStdX    bStdY   bStdXY     SDofX
    -------------+-----------------------------------------------------------------
          weight |    0.0302   10.662    0.000    0.463    0.016    0.247    15.356
          height |   -0.0473   -9.055    0.000   -0.457   -0.025   -0.244     9.660
        constant |    2.6717    3.314    0.001        .        .        .         .
    -------------------------------------------------------------------------------
    
    . stdBeta, nodepvar se
    generate:
    
    -----------------------------------------------------------
        Variable |   Original       Centered     Standardized  
    -------------+---------------------------------------------
          weight |    .03016043      .03016043      .46313689  
                 |    .00282881      .00282881      .04343864  
          height |   -.04730107     -.04730107      -.4569181  
                 |    .00522357      .00522357      .05045859  
           _cons |    2.6717487     -3.0897879     -3.0897879  
                 |    .80622326       .0499536       .0499536  
    -----------------------------------------------------------
                                                   legend: b/se
    
    .
    That gives you the standard errors. You can hand calculate the CIs easily enough. Just multiply the CI's by the Standard deviation of X.

    Hopefully, all the results are internally consistent.

    EDIT: The egen do it yourself approach, listcoef, and stdBeta all give the same values for the X-standardized coefficients. stdBeta and egen both give the same X-standardized standard errors. The egen approach also gives you the CIs so you don't have to calculate them yourself. With the egen approach you could pick and choose which variables got X-standardized, e.g. you could not standardize dummy variables. There may be an even easier approach but I don't know what it is.
    Last edited by Richard Williams; 19 Feb 2018, 18:59.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Perfect! Thank you!

      Comment

      Working...
      X