Announcement

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

  • Lincom and interpreting interaction terms output

    Hi all

    I am trying to analyse cross-sectional data for mortality in a group of individuals.

    The 4 variables are:
    - Sex [sex2]
    - Age grouped into 3 separate 15 year bands [age_grp3]
    - HIV status (positive/negative) [hiv_bin]
    - Year of admission (2011-2015) [adm_yr2]

    Other variables:
    - Unique patient identification number [pat_id]

    I have been asked to report on interaction between HIV status and year of admission in the model, so have used a random effect logistic model for correlated data for repeated admissions by patients:

    xtlogit mort i.sex2 i.age_grp3 i.hiv_bin##i.adm_yr2, i(pat_id) re or

    Below is the output I get.


    ----------------------------------------------------------------------------------------
    mort | OR Std. Err. z P>|z| [95% Conf. Interval]
    -----------------------+----------------------------------------------------------------
    1.sex2 | 1.107274 .088486 1.28 0.202 .9467441 1.295023
    |
    age_grp3 |
    2 | 1.313543 .1279757 2.80 0.005 1.085209 1.589919
    3 | 1.82075 .2034601 5.36 0.000 1.462624 2.266564
    |
    1.hiv_bin | 2.224567 .875704 2.03 0.042 1.028416 4.811962
    |
    adm_yr2 |
    2012 | 2.147864 .9851916 1.67 0.096 .8741255 5.277638
    2013 | 1.14683 .5800134 0.27 0.786 .4255995 3.090276
    2014 | 1.086201 .5485696 0.16 0.870 .4036674 2.922785
    2015 | 3.305442 1.875963 2.11 0.035 1.086778 10.05353
    |
    hiv_bin#adm_yr2 |
    1 2012 | .5969703 .283122 -1.09 0.277 .2356448 1.512334
    1 2013 | .9695291 .5051271 -0.06 0.953 .3492068 2.691777
    1 2014 | .7680384 .4005921 -0.51 0.613 .2763216 2.13477
    1 2015 | .2254525 .1319827 -2.54 0.011 .0715733 .7101649
    |
    _cons | .1062147 .04138 -5.76 0.000 .0494955 .2279308
    -----------------------+----------------------------------------------------------------
    /lnsig2u | -11.16536 15.76088 -42.05612 19.72539
    -----------------------+----------------------------------------------------------------
    sigma_u | .0037625 .0296499 7.37e-10 19200.6
    rho | 4.30e-06 .0000678 1.65e-19 1
    ----------------------------------------------------------------------------------------
    Likelihood-ratio test of rho=0: chibar2(01) = 2.2e-04 Prob >= chibar2 = 0.494


    I've struggled a bit with interaction terms and how best to present them in a table. Obviously sex and age group can be presented as they are, but I struggle with presenting interaction terms.

    I'm presuming that the ORs presented for year are the effect of year in the baseline HIV group (i.e. HIV negative individuals)

    Presumably to get the effect of year in those who are HIV positive, I need the following "lincom" commands?

    lincom 1.hiv_bin + 1.hiv_bin#2011.adm_yr2, or
    lincom 1.hiv_bin + 1.hiv_bin#2012.adm_yr2, or
    lincom 1.hiv_bin + 1.hiv_bin#2013.adm_yr2, or
    lincom 1.hiv_bin + 1.hiv_bin#2014.adm_yr2, or
    lincom 1.hiv_bin + 1.hiv_bin#2015.adm_yr2, or

    Am I able to present how the effect of being HIV positive vs HIV negative by each year?

    Many thanks. I really struggle with interpreting interaction outputs.

    Regards, DS

  • #2
    The -lincom- commands you present above will actually give you, in the odds ratio metric, the effect of hiv_bin in each year. So they are the answer to your final question.

    But they are not correct for getting "the effect of year in those who are HIV positive." For that you need:

    Code:
    lincom 2011.adm_yr2 + 1.hiv_bin#2011.adm_yr2, or
    lincom 2012.adm_yr2 + 1.hiv_bin#2012.adm_yr2, or
    lincom 2013.adm_yr2 + 1.hiv_bin#2013.adm_yr2, or
    lincom 2014.adm_yr2 + 1.hiv_bin#2014.adm_yr2, or
    lincom 2015.adm_yr2 + 1.hiv_bin#2015.adm_yr2, or
    If you want to present your results this way, it is, of course, quite acceptable, even conventional. But for most audiences, odds ratios are not very natural and they are often confused with risk ratios. So I find that when presenting this kind of results to an audience it is better to have a cross-tab of years and hiv_status where the cells contain the predicted probability (adjusted for other variables in the model) for that combination of hiv_status and year. Even better for many purposes is to have a graph with two curves on it. One curve is for HIV + and the other is for HIV - and both curves plot the probability of dying against year of admission. You can get these results with:
    Code:
    margins hiv_bin#adm_yr2
    marginsplot, xdimension(adm_yr2)
    Notes:
    1. The -margins- output will not be in a cross-tab arrangement. You will have to transcribe the data yourself to do it that way (or write a program to create such a table in Stata--probably more trouble than it's worth unless you do this often.)

    2. The -marginsplot- command must be run immediately after the -margins- command. Nothing can happen between them.

    3. If you don't like the appearance of the -marginsplot- graph, you can rerun it and apply almost any of the options available in -graph twoway- to customize its appearance to your preferences.

    I think this view of the results is far more understandable than odds ratios for most audiences. If you have not previously used the -margins- command, an excellent introduction to it is Richard William's piece at http://www.stata-journal.com/sjpdf.h...iclenum=st0260. With that under your belt, the -margins- chapter in the online users manual can tell you about all of the various statistics that you can calculate with this powerful command.

    Comment


    • #3

      Hi Clyde

      Thank you so much for a prompt and informative reply - it's genuinely much appreciated.

      I've just had a chat with a colleague in terms of the data I need/require.

      So if I wanted a dummy table with stratum specific ORs for HIV that had the following to fill in:
      Year 2011 HIV -ve 1.0
      HIV +ve [xx]
      Year 2012 HIV -ve 1.0
      HIV +ve [xx]
      Year 2013 HIV -ve 1.0
      HIV +ve [xx]
      Etc for 2014 and 2015

      And then the main effect of year in the baseline HIV status (i.e. negative):
      2011 1.0
      2012 [xx]
      Etc for 2013-2015....

      ----------------------

      Firstly, for the second table, are the values under "adm_yr2" in the output the values I want (i.e. the effect in the baseline HIV group?) I have a practical session book on interaction that I think has it the wrong way round (it has the ## values in their output as the effect in the baseline group, when I thought these were the interaction values).

      Secondly, if I wanted a table for the stratum specific ORs for HIV by year, what would be the appropriate "lincom" command for that?

      Really sorry about this. As you can see, I really struggle with interaction terms.

      Many thanks again so much.







      Last edited by Dil Singh; 13 Oct 2016, 22:22.

      Comment


      • #4
        Hi Clyde

        Thank you so much for a prompt and informative reply - it's genuinely much appreciated.

        I've just had a chat with a colleague in terms of the data I need/require.

        So if I wanted a dummy table with stratum specific ORs for HIV that had the following to fill in:
        Year 2011 HIV -ve 1.0
        HIV +ve [xx]
        Year 2012 HIV -ve 1.0
        HIV +ve [xx]
        Year 2013 HIV -ve 1.0
        HIV +ve [xx]
        Etc for 2014 and 2015

        And then the main effect of year in the baseline HIV status (i.e. negative):
        2011 1.0
        2012 [xx]
        Etc for 2013-2015....

        ----------------------

        Firstly, for the second table, are the values under "adm_yr2" in the output the values I want (i.e. the effect in the baseline HIV group?) I have a practical session book on interaction that I think has it the wrong way round (it has the ## values in their output as the effect in the baseline group, when I thought these were the interaction values).

        Secondly, if I wanted a table for the stratum specific ORs for HIV by year, what would be the appropriate "lincom" command for that?

        Really sorry about this. As you can see, I really struggle with interaction terms.

        Many thanks again so much.




        Comment


        • #5
          Hi.

          Sorry again, I saw that you've already answered my second question as I was writing the post and couldn't edit it.

          But still just wondering if the output for "adm_yr" is what I would need for the second table.

          Thanks again.

          Comment


          • #6
            For your second table, you would use the odds ratios for 2012.adm_yr through 2015.adm_yr directly from the regression output. (Because this is just in the HIV negative stratum, the interaction terms are not applicable.)

            By the way, going forward please always post code and output, and, for that matter, drafts of table layouts, between code delimiters so that the align properly and are easy to read. See FAQ #12 for instructions on how to use code delimiters.

            Comment

            Working...
            X