Announcement

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

  • Interpretation of interaction term in mixed effects logistic regression model

    Hello,

    I am analysing data for predictors of cigarette smoking among adolescents using mixed effects logistic regression with random effects at school level. Schools were selected from urban and rural locations (strata), then classes were selected within schools and all students in selected classes were studied. The following command was used for the logistic regression analysis using Stata 11:

    Please see the output below:

    Code:
    . xtmelogit cursmkcig stratum agecat sex cwkspend cparentswork sesfat strasesfat
    >  livetog rsmkparents smkfriends smkclass rcignearsch advert antitob shs schcur
    > r if adol==1, || sampschid:, covariance(unstructured) or variance
    Note: single-variable random-effects specification; covariance structure set to
          identity
    
    Refining starting values: 
    
    Iteration 0:   log likelihood = -1437.3631  (not concave)
    Iteration 1:   log likelihood = -1425.2512  
    Iteration 2:   log likelihood =  -1423.267  
    
    Performing gradient-based optimization: 
    
    Iteration 0:   log likelihood =  -1423.267  
    Iteration 1:   log likelihood = -1423.2267  
    Iteration 2:   log likelihood = -1423.2265  
    
    Mixed-effects logistic regression               Number of obs      =      4332
    Group variable: sampschid                       Number of groups   =        49
    
                                                    Obs per group: min =        50
                                                                   avg =      88.4
                                                                   max =       115
    
    Integration points =   7                        Wald chi2(16)      =    371.02
    Log likelihood = -1423.2265                     Prob > chi2        =    0.0000
    
    ------------------------------------------------------------------------------
       cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         stratum |   1.237299   .2309897     1.14   0.254     .8581532    1.783957
          agecat |    .906214   .0860734    -1.04   0.300     .7522852    1.091639
             sex |   .7272792   .0804917    -2.88   0.004     .5854562    .9034579
        cwkspend |   1.270641    .085474     3.56   0.000     1.113689    1.449712
    cparentswork |   .6930044   .0564859    -4.50   0.000     .5906846    .8130483
          sesfat |   .7812136   .1303561    -1.48   0.139     .5632942    1.083439
      strasesfat |   1.821569   .4241586     2.58   0.010     1.154092    2.875086
         livetog |    1.27858   .1680938     1.87   0.062     .9881464    1.654378
     rsmkparents |   1.502987   .1489246     4.11   0.000     1.237694    1.825144
      smkfriends |   1.922712   .1552835     8.09   0.000     1.641228    2.252473
        smkclass |   1.397217   .1085893     4.30   0.000     1.199803    1.627113
     rcignearsch |   1.779504   .2280784     4.50   0.000     1.384206     2.28769
          advert |   1.372885   .1807741     2.41   0.016     1.060602    1.777116
         antitob |    1.12164   .1596499     0.81   0.420     .8485873    1.482553
             shs |   2.002395   .2363955     5.88   0.000     1.588766    2.523711
         schcurr |   .5912504    .069033    -4.50   0.000     .4703131    .7432857
    ------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    sampschid: Identity          |
                      var(_cons) |   .2302386   .0713563      .1254213    .4226541
    ------------------------------------------------------------------------------
    LR test vs. logistic regression: chibar2(01) =    50.32 Prob>=chibar2 = 0.0000
    The dependent variable is current cigarette smoking (cursmkcig). The main independent variable is school location (stratum) labelled as urban or rural. The variable strasesfat is an interaction term between socioeconomic status (sesfat) and school location (stratum). Since there is evidence of interaction from the above output, I would like to know how to present the results reporting the association between practice of current smoking and school location within each level of socioeconomic status (low SES and high SES).

    I tried reporting coefficients and using lincom command and it didn't work.

    Code:
    . xtmelogit cursmkcig stratum agecat sex cwkspend cparentswork sesfat strasesfat
    > livetog rsmkparents smkfriends smkclass rcignearsch advert antitob shs schcur
    > r if adol==1, || sampschid:, covariance(unstructured) variance
    Note: single-variable random-effects specification; covariance structure set to
          identity
    
    Refining starting values: 
    
    Iteration 0:   log likelihood = -1437.3631  (not concave)
    Iteration 1:   log likelihood = -1425.2512  
    Iteration 2:   log likelihood =  -1423.267  
    
    Performing gradient-based optimization: 
    
    Iteration 0:   log likelihood =  -1423.267  
    Iteration 1:   log likelihood = -1423.2267  
    Iteration 2:   log likelihood = -1423.2265  
    
    Mixed-effects logistic regression               Number of obs      =      4332
    Group variable: sampschid                       Number of groups   =        49
    
                                                    Obs per group: min =        50
                                                                   avg =      88.4
                                                                   max =       115
    
    Integration points =   7                        Wald chi2(16)      =    371.02
    Log likelihood = -1423.2265                     Prob > chi2        =    0.0000
    
    ------------------------------------------------------------------------------
       cursmkcig |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         stratum |   .2129306   .1866887     1.14   0.254    -.1529726    .5788338
          agecat |  -.0984798   .0949813    -1.04   0.300    -.2846397    .0876802
             sex |  -.3184449   .1106751    -2.88   0.004     -.535364   -.1015257
        cwkspend |   .2395212   .0672684     3.56   0.000     .1076775    .3713649
    cparentswork |   -.366719   .0815087    -4.50   0.000    -.5264731   -.2069648
          sesfat |  -.2469067   .1668636    -1.48   0.139    -.5739533    .0801398
      strasesfat |   .5996982   .2328534     2.58   0.010     .1433138    1.056083
         livetog |   .2457503   .1314691     1.87   0.062    -.0119244    .5034249
     rsmkparents |   .4074544   .0990858     4.11   0.000     .2132498    .6016589
      smkfriends |   .6537365   .0807628     8.09   0.000     .4954445    .8120286
        smkclass |   .3344821   .0777183     4.30   0.000     .1821571    .4868072
     rcignearsch |   .5763345   .1281697     4.50   0.000     .3251265    .8275424
          advert |   .3169141   .1316746     2.41   0.016     .0588366    .5749917
         antitob |   .1147916   .1423362     0.81   0.420    -.1641823    .3937654
             shs |   .6943441   .1180564     5.88   0.000     .4629579    .9257303
         schcurr |  -.5255157   .1167577    -4.50   0.000    -.7543566   -.2966748
           _cons |  -4.025837   .4399083    -9.15   0.000    -4.888042   -3.163633
    ------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    sampschid: Identity          |
                      var(_cons) |   .2302386   .0713563      .1254213    .4226541
    ------------------------------------------------------------------------------
    LR test vs. logistic regression: chibar2(01) =    50.32 Prob>=chibar2 = 0.0000
    
    . *Use lincom command to estimate combination of odds ratios
    
    . lincom _cons + sesfat, or
    
     ( 1)  [eq1]sesfat + [eq1]_cons = 0
    
    ------------------------------------------------------------------------------
       cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             (1) |   .0139435   .0062817    -9.48   0.000     .0057663    .0337167
    ------------------------------------------------------------------------------
    
    . *OR for student with low father's education living in urban area
    
    . lincom _cons, or
    
     ( 1)  [eq1]_cons = 0
    
    ------------------------------------------------------------------------------
       cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             (1) |   .0178485   .0078517    -9.15   0.000     .0075362    .0422719
    ------------------------------------------------------------------------------
    
    . *OR for student with high father's education living in urban area
    
    . lincom _cons + sesfat, or
    
     ( 1)  [eq1]sesfat + [eq1]_cons = 0
    
    ------------------------------------------------------------------------------
       cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             (1) |   .0139435   .0062817    -9.48   0.000     .0057663    .0337167
    ------------------------------------------------------------------------------
    
    . *OR for student with low father's education living in rural area
    
    . lincom _cons + stratum, or
    
     ( 1)  [eq1]stratum + [eq1]_cons = 0
    
    ------------------------------------------------------------------------------
       cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             (1) |   .0220839   .0096375    -8.74   0.000     .0093887    .0519452
    ------------------------------------------------------------------------------
    
    . *OR for student with high father's education living in rural area
    
    . lincom _cons + stratum + sesfat + strasesfat, or
    
     ( 1)  [eq1]stratum + [eq1]sesfat + [eq1]strasesfat + [eq1]_cons = 0
    
    ------------------------------------------------------------------------------
       cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             (1) |   .0314261   .0142652    -7.62   0.000     .0129094    .0765026
    ------------------------------------------------------------------------------
    I also tried performing the analysis to report stratum-specific odds ratios using the variable 'strases' as the interaction term, and the output showed evidence of collinearity

    Code:
     . xtmelogit cursmkcig stratum agecat sex cwkspend cparentswork sesfat strases* l
    > ivetog rsmkparents smkfriends smkclass rcignearsch advert antitob shs schcurr 
    > if adol==1, || sampschid:, covariance(unstructured) or variance
    Note: single-variable random-effects specification; covariance structure set to
          identity
    note: strases1 omitted because of collinearity
    
    Refining starting values: 
    
    Iteration 0:   log likelihood = -1437.3631  (not concave)
    Iteration 1:   log likelihood = -1425.2494  
    Iteration 2:   log likelihood = -1423.2669  
    
    Performing gradient-based optimization: 
    
    Iteration 0:   log likelihood = -1423.2669  
    Iteration 1:   log likelihood = -1423.2267  
    Iteration 2:   log likelihood = -1423.2265  
    
    Mixed-effects logistic regression               Number of obs      =      4332
    Group variable: sampschid                       Number of groups   =        49
    
                                                    Obs per group: min =        50
                                                                   avg =      88.4
                                                                   max =       115
    
    Integration points =   7                        Wald chi2(16)      =    371.02
    Log likelihood = -1423.2265                     Prob > chi2        =    0.0000
    
    ------------------------------------------------------------------------------
       cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         stratum |   2.253825   .5379541     3.40   0.001     1.411729    3.598233
          agecat |    .906214   .0860734    -1.04   0.300     .7522852    1.091639
             sex |   .7272792   .0804917    -2.88   0.004     .5854561    .9034579
        cwkspend |   1.270641    .085474     3.56   0.000     1.113689    1.449712
    cparentswork |   .6930044   .0564859    -4.50   0.000     .5906846    .8130483
          sesfat |   .7812134   .1303561    -1.48   0.139     .5632941    1.083438
        strases0 |   .5489772   .1278312    -2.58   0.010     .3478156    .8664819
        strases1 |  (omitted)
         livetog |    1.27858   .1680938     1.87   0.062     .9881464    1.654378
     rsmkparents |   1.502987   .1489246     4.11   0.000     1.237694    1.825144
      smkfriends |   1.922712   .1552835     8.09   0.000     1.641228    2.252473
        smkclass |   1.397217   .1085893     4.30   0.000     1.199803    1.627113
     rcignearsch |   1.779504   .2280784     4.50   0.000     1.384206     2.28769
          advert |   1.372885   .1807741     2.41   0.016     1.060602    1.777116
         antitob |    1.12164   .1596499     0.81   0.420     .8485873    1.482553
             shs |   2.002395   .2363955     5.88   0.000     1.588766    2.523711
         schcurr |   .5912504    .069033    -4.50   0.000     .4703131    .7432856
    ------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    sampschid: Identity          |
                      var(_cons) |   .2302386   .0713563      .1254213    .4226542
    ------------------------------------------------------------------------------
    LR test vs. logistic regression: chibar2(01) =    50.32 Prob>=chibar2 = 0.0000
    Thank you.


  • #2
    So, the -lincom- approach gives odds ratios that are conditional on all other variables being zero, which given the large odds ratios associated with several of your other variables means these are probably not statistics of interest for practical purposes. You don't actually explain the other variables (and I'm not asking you to) but often it isn't even possible for them to be zero, or being zero would be an unusual case. You need to use the -margins- command. But you can't, because you didn't use factor variable notation in your regression command. So read -help fvvarlist- to learn about factor variable notation, and then revise your command. I will apply it here to stratum and sesfat, which I assume are discrete variables. You should also apply it to other variables as appropriate:

    Code:
    xtmelogit cursmkcig i.stratum##i.sesfat agecat sex cwkspend cparentswork ///
    livetog rsmkparents smkfriends smkclass rcignearsch advert antitob shs schcur ///
    r if adol==1, || sampschid:, or variance
    
    margins stratum#sesfat
    The output of -margins- will show you the predicted probabilities of smoking in each combination of stratum and sesfat, adjusted to the distribution of other variables. There is much more you can get from -margins-. The best introduction to the -margins- command around is the excellent Richard Williams' https://www3.nd.edu/~rwilliam/stats/Margins01.pdf. It includes worked examples, some of which are interaction models like yours.

    Other comments:

    1. If you are running a recent version of Stata, the command is now called -melogit-. The old name still works, but is no longer preferred.

    2. It seems to me that this analysis is not well matched to your data. You describe a complex survey design with strata and PSU's, but you are not using a design-based analysis. While the use of random effects will account for some of the departures from simple random sampling, it certainly does not reflect the stratification, nor does it appear to fully reflect selection either. You might want to look into doing this with -svy:-.

    Comment


    • #3
      Thank you, Clyde! I will try the margins command and 'logistic regression using 'svy'.

      Comment


      • #4
        Hi Clyde,

        I tried the margins command and received the following output. I don't know what is wrong..
        Code:
         . xtmelogit cursmkcig i.stratum##i.sesfat agecat sex cwkspend cparentswork livet
        			> og rsmkparents smkfriends smkclass rcignearsch advert antitob shs schcurr if a
        			> dol==1, || sampschid:, or variance
        			
        			Refining starting values: 
        			
        			Iteration 0:   log likelihood = -1437.3631  (not concave)
        			Iteration 1:   log likelihood = -1425.2512  
        			Iteration 2:   log likelihood =  -1423.267  
        			
        			Performing gradient-based optimization: 
        			
        			Iteration 0:   log likelihood =  -1423.267  
        			Iteration 1:   log likelihood = -1423.2267  
        			Iteration 2:   log likelihood = -1423.2265  
        			
        			Mixed-effects logistic regression               Number of obs      =      4332
        			Group variable: sampschid                       Number of groups   =        49
        			
        			                                                Obs per group: min =        50
        			                                                               avg =      88.4
        			                                                               max =       115
        			
        			Integration points =   7                        Wald chi2(16)      =    371.02
        			Log likelihood = -1423.2265                     Prob > chi2        =    0.0000
        			
        			------------------------------------------------------------------------------
        			   cursmkcig | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
        			-------------+----------------------------------------------------------------
        			   1.stratum |   1.237299   .2309897     1.14   0.254     .8581533    1.783957
        			    1.sesfat |   .7812136   .1303561    -1.48   0.139     .5632942    1.083439
        			             |
        			     stratum#|
        			      sesfat |
        			        1 1  |   1.821569   .4241586     2.58   0.010     1.154092    2.875086
        			             |
        			      agecat |    .906214   .0860734    -1.04   0.300     .7522852    1.091639
        			         sex |   .7272792   .0804917    -2.88   0.004     .5854562    .9034579
        			    cwkspend |   1.270641    .085474     3.56   0.000     1.113689    1.449712
        			cparentswork |   .6930044   .0564859    -4.50   0.000     .5906846    .8130483
        			     livetog |    1.27858   .1680938     1.87   0.062     .9881464    1.654378
        			 rsmkparents |   1.502987   .1489246     4.11   0.000     1.237694    1.825144
        			  smkfriends |   1.922712   .1552835     8.09   0.000     1.641228    2.252473
        			    smkclass |   1.397217   .1085893     4.30   0.000     1.199803    1.627113
        			 rcignearsch |   1.779504   .2280784     4.50   0.000     1.384206     2.28769
        			      advert |   1.372885   .1807741     2.41   0.016     1.060602    1.777116
        			     antitob |    1.12164   .1596499     0.81   0.420     .8485873    1.482553
        			         shs |   2.002395   .2363955     5.88   0.000     1.588766    2.523711
        			     schcurr |   .5912504    .069033    -4.50   0.000     .4703131    .7432857
        			------------------------------------------------------------------------------
        			
        			------------------------------------------------------------------------------
        			  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
        			-----------------------------+------------------------------------------------
        			sampschid: Identity          |
        			                  var(_cons) |   .2302386   .0713562      .1254213     .422654
        			------------------------------------------------------------------------------
        			LR test vs. logistic regression: chibar2(01) =    50.32 Prob>=chibar2 = 0.0000
        			
        			. margins stratum#sesfat
        			default prediction is a function of possibly stochastic quantities other than
        			e(b)
        			r(498).

        Comment


        • #5
          What version of Stata are you using? I'm running the current version, 15.1, and I have no problem getting -margins- to work after -melogit-. But I vaguely recall that in earlier versions, it would not.

          Comment


          • #6
            Oh! Running Stata 11. I will try 'svy' . Thank you

            Comment

            Working...
            X