Announcement

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

  • Using "lincom" after "margins"

    Hello.

    I have a question with respect to using the lincom command after the margins command. Specifically:
    Code:
    margins, dydx(x1 x2) at(x1=(-1 1) m=1) at(x2=(-1 1) m=1)
    The output is the following:
    Code:
    1._at        : x1              =          -1
                   m               =           1
    
    2._at        : x1              =           1
                   m               =           1
    
    3._at        : m               =           1
                   x2              =          -1
    
    4._at        : m               =           1
                   x2              =           1
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    x1           |
             _at |
              1  |   .0209352   .0082171     2.55   0.011     .0047658    .0371046
              2  |  -.0156448   .0142666    -1.10   0.274    -.0437181    .0124286
              3  |  -.0001046   .0096455    -0.01   0.991    -.0190849    .0188756
              4  |  -.0001046   .0096455    -0.01   0.991    -.0190849    .0188756
    -------------+----------------------------------------------------------------
    x2           |
             _at |
              1  |  -.0038224   .0203805    -0.19   0.851    -.0439267    .0362818
              2  |  -.0038224   .0203805    -0.19   0.851    -.0439267    .0362818
              3  |  -.0310065   .0207587    -1.49   0.136    -.0718548    .0098418
              4  |   .0131324   .0292628     0.45   0.654    -.0444501    .0707149
    ------------------------------------------------------------------------------
    I want to compare now 1._at in x1 with 3._at in x2, and 2._at in x1 with 4._at in x2. I use the two commands below:
    Code:
    lincom [x1]_b[1._at]-[x2]_b[3._at]
    lincom [x1]_b[2._at]-[x2]_b[4._at]
    but get a message:
    Code:
    equation [x1] not found
    r(303);
    Would be grateful for any help.
    Last edited by Marco Tacchi; 02 Nov 2019, 07:02.

  • #2
    You should use the -post- option on margins.

    Also, you might want to look at the mlincom command that comes with spost13. It and other spost13 commands can make things easier

    findit spost13_ado

    The help file says

    mlincom uses lincom to compute linear combinations of estimates from margins, post. This lets you estimates discrete changes, second differences, and other linear combinations. Results can be accumlated from multiple mlincom commands. Computing a second difference is as simple as mlincom (1-2)-(3-4) which computes the difference betweeen the first and second estimate from margins, the difference between the third and fourth, and then the difference between these differences.
    -------------------------------------------
    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
      Dear Richard,

      Thank you for your help. I will also check spost13.

      Comment

      Working...
      X