Announcement

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

  • Margins returns non-estimable for cross-level continuous-by-continuous interaction

    I am running a cross-sectional regression of individuals nested in regions. I want to plot my cross-level continuous-by-continuous interaction in Stata, but margins returns non-estimable results similar to this post on Statalist. I have followed the code provided by Huber (2024) and Mize (2019). A peculiarity of my regression equation is that my variable success2017 is operationalized at the region level while wexp_dec is a individual-level variable. So everyone residing in region 81802 has the same value for success2017. Thus, when I delete my region variable from my regression equation, the margins are estimable. I would like to control for effects of regions, therefore I am trying to understand why margins are not estimable when I include i.regions as control variable. Given that 81829.region is even omitted I am wondering if it even makes sense to include it due to multicollinearity with my success2017 variable. In addition my success2017 variable, technically a count variable, does not vary substantially across my 22 clusters:

    Code:
    . tab success2017 if sample1 == 1
    
      Number of |
     successful |
         terror |
        attacks |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              0 |        267       43.27       43.27
              1 |        151       24.47       67.75
              2 |         96       15.56       83.31
              3 |         36        5.83       89.14
              4 |         12        1.94       91.09
              9 |         55        8.91      100.00
    ------------+-----------------------------------
          Total |        617      100.00
    I have searched the forum to make sure the issue is not due to sparse data or data transformations. I am using Stata 18, the estout package to save my regression, but the issue persists with estimates store.

    Code:
    . eststo m4s1: regress entrepreneur c.success2017##c.wexp_dec yrschl sex age wealth i.agegrp1 i.ftempst i.mtempst i.industry i.region, vce(cluster region)
    note: 81829.region omitted because of collinearity.
    
    Linear regression                               Number of obs     =     12,905
                                                    F(20, 21)         =          .
                                                    Prob > F          =          .
                                                    R-squared         =     0.2155
                                                    Root MSE          =     .34502
    
                                                                                                   (Std. err. adjusted for 22 clusters in region)
    ------------------------------------------------------------------------------------------------------------------------------------------
                                                                             |               Robust
                                                                      binary | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------------------------------------------------------------------+----------------------------------------------------------------
                                                                 success2017 |  -.0120273   .0019472    -6.18   0.000    -.0160766   -.0079779
                                                                    wexp_dec |   .0152098   .0062019     2.45   0.023     .0023123    .0281073
                                                                             |
                                                    c.success2017#c.wexp_dec |   -.000852   .0008696    -0.98   0.338    -.0026603    .0009564
                                                                             |
                                                                      yrschl |  -.0064609   .0008229    -7.85   0.000    -.0081722   -.0047495
                                                                         sex |   .0697372   .0173574     4.02   0.001     .0336406    .1058338
                                                                         age |   .0048026   .0010555     4.55   0.000     .0026076    .0069976
                                                                      wealth |   .0323867   .0054624     5.93   0.000     .0210269    .0437464
                                                                             |
                                                                     agegrp1 |
                                                                      20-29  |    .037372   .0119208     3.14   0.005     .0125814    .0621627
                                                                      30-39  |   .0574466   .0151769     3.79   0.001     .0258845    .0890088
                                                                      40-49  |   .0624703   .0205178     3.04   0.006     .0198011    .1051395
                                                                      50-59  |   .0043326   .0314286     0.14   0.892    -.0610267     .069692
                                                                             |
                                                                     ftempst |
                                                                   Employer  |   .0952247   .0209271     4.55   0.000     .0517044     .138745
                                                              Self-employed  |   .0862964   .0184917     4.67   0.000     .0478408     .124752
                                                       Unpaid Family Worker  |   .0545797   .0222154     2.46   0.023     .0083803    .1007791
                                                                     No job  |  -.0046843   .0160046    -0.29   0.773    -.0379677    .0285991
                                                                             |
                                                                     mtempst |
                                                                   Employer  |   .1440686   .0704173     2.05   0.053    -.0023722    .2905093
                                                              Self-employed  |   .0144593   .0372725     0.39   0.702    -.0630531    .0919718
                                                       Unpaid Family Worker  |   .0200647   .0243945     0.82   0.420    -.0306665    .0707959
                                                                     No job  |   .0047677   .0105402     0.45   0.656    -.0171518    .0266872
                                                                             |
                                                                    industry |
                                                    B: Mining and quarrying  |   -.262818   .0375383    -7.00   0.000    -.3408832   -.1847528
                                                           C: Manufacturing  |  -.1115117   .0235172    -4.74   0.000    -.1604184    -.062605
                     D: Electricity; gas ;steam and air conditioning supply  |  -.2573552   .0281989    -9.13   0.000    -.3159981   -.1987123
       E: Water supply; sewage; waste management and remediation activities  |  -.2556701   .0395117    -6.47   0.000    -.3378392    -.173501
                                                            F: Construction  |  -.1712579   .0211831    -8.08   0.000    -.2153106   -.1272051
    G: Wholesale and retail trade; repair of motor vehicles and motorcycles  |   .1484533   .0279618     5.31   0.000     .0903034    .2066031
                                              H: Transportation and storage  |  -.0223906   .0284908    -0.79   0.441    -.0816405    .0368593
                                I: Accomodation and food service activities  |  -.0902359   .0317633    -2.84   0.010    -.1562913   -.0241805
                                           J: Information and communication  |  -.1550058   .0329322    -4.71   0.000    -.2234921   -.0865195
                                      K: Financial and insurance activities  |  -.2707193    .026727   -10.13   0.000    -.3263011   -.2151375
                                                  L: Real estate activities  |  -.1381896   .0993548    -1.39   0.179    -.3448093    .0684301
                       M: Professional, scientific and technical activities  |  -.0211367   .0407144    -0.52   0.609    -.1058068    .0635335
                           N: Administrative and support service activities  |  -.0987987   .0404536    -2.44   0.024    -.1829266   -.0146707
           O: Public administration and defense; compulsory social security  |  -.2975099   .0312719    -9.51   0.000    -.3625433   -.2324765
                                                               P: Education  |  -.3169317   .0261864   -12.10   0.000    -.3713894    -.262474
                                 Q: Human health and social work activities  |  -.2670172   .0345601    -7.73   0.000     -.338889   -.1951455
                                      R: Arts, entertainment and recreation  |  -.0839496    .066044    -1.27   0.218    -.2212956    .0533963
                                                S: Other service activities  |   .0084707   .0326348     0.26   0.798     -.059397    .0763384
                                   T: Activities of households as employers  |  -.2044904   .0489098    -4.18   0.000    -.3062038   -.1027769
                                                                             |
                                                                      region |
                                                                      81802  |   -.054901    .004231   -12.98   0.000    -.0636998   -.0461022
                                                                      81803  |  -.1267773   .0077364   -16.39   0.000     -.142866   -.1106886
                                                                      81804  |  -.1195553   .0076251   -15.68   0.000    -.1354126    -.103698
                                                                      81811  |  -.0363183   .0045726    -7.94   0.000    -.0458275   -.0268091
                                                                      81812  |  -.0125566   .0030342    -4.14   0.000    -.0188666   -.0062466
                                                                      81813  |  -.0139016   .0037377    -3.72   0.001    -.0216746   -.0061286
                                                                      81814  |  -.0363994   .0044659    -8.15   0.000    -.0456868   -.0271121
                                                                      81815  |   .0582761   .0057104    10.21   0.000     .0464006    .0701516
                                                                      81816  |   .0440068   .0037471    11.74   0.000     .0362143    .0517993
                                                                      81817  |  -.0452524   .0033462   -13.52   0.000    -.0522113   -.0382935
                                                                      81818  |   .0480972   .0061692     7.80   0.000     .0352676    .0609268
                                                                      81819  |  -.0714969   .0035887   -19.92   0.000      -.07896   -.0640338
                                                                      81821  |  -.0198335   .0029578    -6.71   0.000    -.0259846   -.0136824
                                                                      81822  |   .0057244   .0049058     1.17   0.256    -.0044778    .0159267
                                                                      81823  |   .0127686   .0071789     1.78   0.090    -.0021606    .0276979
                                                                      81824  |   .0555532   .0046511    11.94   0.000     .0458807    .0652256
                                                                      81825  |   .0521494   .0038058    13.70   0.000     .0442349     .060064
                                                                      81826  |   .0199532   .0033738     5.91   0.000      .012937    .0269694
                                                                      81827  |   .0072533    .004321     1.68   0.108    -.0017326    .0162392
                                                                      81828  |  -.0804134   .0025937   -31.00   0.000    -.0858072   -.0750195
                                                                      81829  |          0  (omitted)
                                                                             |
                                                                       _cons |   .0783073   .0301393     2.60   0.017     .0156292    .1409853
    ------------------------------------------------------------------------------------------------------------------------------------------
    Compute the AME for one side:
    Code:
    margins, dydx(success2017) at(wexp_dec = (0(0.1)5))
    --- Code surpressed, but works ---
    However, testing the AME for the other side does not work the other side of my interaction does not work:
    Code:
    . margins, dydx(wexp_dec) at(success2017 = (0(0.5)2))
    
    Average marginal effects                                Number of obs = 12,905
    Model VCE: Robust
    
    Expression: Linear prediction, predict()
    dy/dx wrt:  wexp_dec
    1._at: success2017 =   0
    2._at: success2017 =  .5
    3._at: success2017 =   1
    4._at: success2017 = 1.5
    5._at: success2017 =   2
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    wexp_dec     |
             _at |
              1  |          .  (not estimable)
              2  |          .  (not estimable)
              3  |          .  (not estimable)
              4  |          .  (not estimable)
              5  |          .  (not estimable)
    ------------------------------------------------------------------------------
    __________________________________________________ __________

    Cheers, Felix
    Stata Version: MP 18.0
    OS: Windows 11

  • #2
    I think it is due to omitted variables in the regression, which Stata must drop for identification. You may type noestimcheck as an option, but this is risky.

    On a sidenote; when dealing with continuous by continuous interactions, it helps to demean the variables; for interpretation.

    Comment


    • #3
      You may type noestimcheck as an option, but this is risky.
      It is, in general, risky. There are occasional situations where it is OK to do. But in the situation described in #1, it is outright wrong.

      The problem is that the variable success2017 is defined at the region level. This implies that the observations where success2017 == 1 is exactly the collection of observations with some particular set of values on the region variable, and the observations where success2017 == 0 is exactly the collection of observations with the complementary set of values on the region variable. This makes sucess2017 colinear with the collection of i.region variables. And O.P. correctly notes that the omission of a level of region from the analysis (other than the base value) is a sign of this. When you have colinear variables like this, you cannot estimate effects associated with them because the model as a whole is not identified. The omission of one particular value of region makes the model identified. BUT, there are many ways to identify the model. Any other non-base value of region could have been omitted. Or success2017 could have been omitted. Or any single linear constraint could have been imposed, e.g. 2.71828*_b[81811.region] - _b[81827.region]/3.14159 = 0. There are infinitely many possible ways to break the colinearity and identify the model. The problem is that the value of the marginal effects of the region and success2017 variables will differ depending on the chosen way to identify the model. So no model that contains colinear variables can ever be used to identify effects among the variables participating in the colinearity: those effects literally do not exist in such a model, they are just artifacts of arbitrarily chosen identifying constraints.

      So, sorry, but you cannot use -noestimcheck- here. Or, rather, you can, but the results you get will be utterly meaningless.

      On the positive side, if you omit i.region from your model, then this identification problem goes away and you can certainly estimate a marginal effect of success2017 in that model.
      Last edited by Clyde Schechter; 16 Oct 2024, 10:03.

      Comment


      • #4
        Dear Clyde, thank you for your comment and detailed explanation. It solves a big headache for me.
        Last edited by Felix Kaysers; 16 Oct 2024, 10:33.
        __________________________________________________ __________

        Cheers, Felix
        Stata Version: MP 18.0
        OS: Windows 11

        Comment

        Working...
        X