Announcement

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

  • Is it possible to obtain p-values for margins contrasts?

    I run a linear mixed model (shown below). I want to get a p-value for each of the margin comparisons. For example, how do I get a p-value for 1#Not Black vs. 1#Black in the margins table. Your help will be appreciated.

    Code:
     mixed sbp ib6.group c.NaK##i.black_or_not i.stratum age i.sex dbp || id2:
    
    Performing EM optimization ...
    
    Performing gradient-based optimization:
    Iteration 0:  Log likelihood = -20033.822  
    Iteration 1:  Log likelihood = -20033.822  
    
    Computing standard errors ...
    
    Mixed-effects ML regression                         Number of obs    =   5,542
    Group variable: id2                                 Number of groups =     884
                                                        Obs per group:
                                                                     min =       1
                                                                     avg =     6.3
                                                                     max =       7
                                                        Wald chi2(12)    = 4419.31
    Log likelihood = -20033.822                         Prob > chi2      =  0.0000
    
    ------------------------------------------------------------------------------------
                   sbp | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------------+----------------------------------------------------------------
                 group |
           Acebutolol  |  -3.520989   .9389604    -3.75   0.000    -5.361318   -1.680661
           Amlodipine  |  -4.247379   .9538252    -4.45   0.000    -6.116842   -2.377916
       Chlorthalidone  |  -4.875394   .9388959    -5.19   0.000    -6.715596   -3.035192
            Doxazosin  |  -2.144564   .9343436    -2.30   0.022    -3.975844   -.3132841
            Enalapril  |   -2.51117   .9396513    -2.67   0.008    -4.352852   -.6694871
                       |
                   NaK |   .5992256   .0808056     7.42   0.000     .4408496    .7576017
                       |
          black_or_not |
                Black  |   2.374209   .8903708     2.67   0.008     .6291142    4.119304
                       |
    black_or_not#c.NaK |
                Black  |  -.3278207   .1302357    -2.52   0.012    -.5830779   -.0725635
                       |
             2.stratum |   .3558746   .5942132     0.60   0.549    -.8087618    1.520511
                   age |   .5579565   .0451791    12.35   0.000     .4694071    .6465058
                       |
                   sex |
               Female  |   2.839032   .6170714     4.60   0.000     1.629594     4.04847
                   dbp |   1.118812   .0177193    63.14   0.000     1.084082    1.153541
                 _cons |   5.388162   3.020926     1.78   0.074    -.5327437    11.30907
    ------------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects parameters  |   Estimate   Std. err.     [95% conf. interval]
    -----------------------------+------------------------------------------------
    id2: Identity                |
                      var(_cons) |   63.13963    3.48728      56.66163    70.35823
    -----------------------------+------------------------------------------------
                   var(Residual) |   58.50251   1.212088      56.17445    60.92706
    ------------------------------------------------------------------------------
    LR test vs. linear model: chibar2(01) = 2268.80       Prob >= chibar2 = 0.0000
    
    . testparm c.NaK#i.black_or_not
    
     ( 1)  [sbp]2.black_or_not#c.NaK = 0
    
               chi2(  1) =    6.34
             Prob > chi2 =    0.0118
    
    . margins black_or_not, at(NaK= (1.62 3.12 4.62 )) vsquish
    
    Predictive margins                                       Number of obs = 5,542
    
    Expression: Linear prediction, fixed portion, predict()
    1._at: NaK = 1.62
    2._at: NaK = 3.12
    3._at: NaK = 4.62
    
    ----------------------------------------------------------------------------------
                     |            Delta-method
                     |     Margin   std. err.      z    P>|z|     [95% conf. interval]
    -----------------+----------------------------------------------------------------
    _at#black_or_not |
        1#Not Black  |   124.0313   .3401181   364.67   0.000     123.3647    124.6979
            1#Black  |   125.8744   .7170319   175.55   0.000     124.4691    127.2798
        2#Not Black  |   124.9301   .3228599   386.95   0.000     124.2973    125.5629
            2#Black  |   126.2815   .6839433   184.64   0.000      124.941     127.622
        3#Not Black  |   125.8289    .349542   359.98   0.000     125.1439     126.514
            3#Black  |   126.6886   .6844899   185.08   0.000     125.3471    128.0302
    ----------------------------------------------------------------------------------

  • #2
    Rerun the -margins- command adding the -pwcompare- option.

    Comment


    • #3
      Thank you, Clyde

      Comment

      Working...
      X