Announcement

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

  • Why margins command is returning "not estimable" using Fixed effects methods?

    I am using an individual fixed effect method in panel data. I look at whether the working hours changed differently between men and women following the 2008 financial crisis.

    Here is a simple model in Stata

    Code:
    . xtreg workhours c.age i.sex##i.crisis, fe vce(cluster id)
    note: 2.sex omitted because of collinearity.
    
    Fixed-effects (within) regression               Number of obs     =    347,296
    Group variable: id                              Number of groups  =    151,470
    
    R-squared:                                      Obs per group:
         Within  = 0.0294                                         min =          1
         Between = 0.0005                                         avg =        2.3
         Overall = 0.0000                                         max =          8
    
                                                    F(3,151469)       =     860.46
    corr(u_i, Xb) = -0.2371                         Prob > F          =     0.0000
    
                                        (Std. err. adjusted for 151,470 clusters in id)
    -----------------------------------------------------------------------------------
                      |               Robust
           workhours | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    ------------------+----------------------------------------------------------------
                  age |  -.2027896   .0151701   -13.37   0.000    -.2325227   -.1730565
                      |
                  sex |
                Male  |          0  (omitted)
                      |
              crisis |
         Post-crisis  |   -3.43855   .1232942   -27.89   0.000    -3.680204   -3.196896
                      |
          sex#crisis |
    Male#Post-crisis  |  -.7873883   .1692412    -4.65   0.000    -1.119098   -.4556789
                      |
                _cons |   49.76833   .5767537    86.29   0.000     48.63791    50.89876
    ------------------+----------------------------------------------------------------
              sigma_u |  9.8865584
              sigma_e |  6.8570233
                  rho |  .67520132   (fraction of variance due to u_i)
    -----------------------------------------------------------------------------------
    Here is how my variables are coded:

    Code:
    input double(workhours age) long sex float education long crisis
    50 25 2 1 1
    45 26 2 1 1
    52 46 2 2 1
    60 47 2 2 1
    42 43 2 3 1
    38 25 1 1 1
    40 26 1 1 1
    45 25 2 3 1
    38 45 2 2 1
    38 46 2 2 1
    40 39 1 3 0
    40 40 1 3 0
    40 39 1 3 0

    In the model above sex (2=Male, 1=Female) and education are time fixed for each individual and hence constant over time. The crisis variable is a dummy variable (0= before 2008, 1= post 2008) that changes over time.

    The interaction of interest sex##crisis tells me whether the gap in working hours has increased or decreased following the financial crisis. The findings show that the gap increases following the crisis, however, I am interested to see whether this increase is driven by a decrease in working hours for men or by an increase in working hours for women or whether it is driven by both cases. Thus, I would like to run the average marginal effects to see graphically the association between both variables. After running
    Code:
    margins crisis##sex
    , I get the following output:

    Code:
    
    Predictive margins                                     Number of obs = 347,296
    Model VCE: Robust
    
    Expression: Linear prediction, predict()
    
    -------------------------------------------------------------------------------------
                        |            Delta-method
                        |     Margin   std. err.      z    P>|z|     [95% conf. interval]
    --------------------+----------------------------------------------------------------
                    sex |
                Female  |          .  (not estimable)
                  Male  |          .  (not estimable)
                        |
                crisis |
            Pre-crisis  |   41.91534   .0647819   647.02   0.000     41.78837    42.04231
           Post-crisis  |   38.05804   .0213521  1782.40   0.000     38.01619    38.09989
                        |
            sex#crisis |
     Female#Pre-crisis  |          .  (not estimable)
    Female#Post-crisis  |          .  (not estimable)
       Male#Pre-crisis  |          .  (not estimable)
      Male#Post-crisis  |          .  (not estimable)
    -------------------------------------------------------------------------------------

    There are two different threads on Stata list that recommends not to include the main effect. This means that my interaction should be used in the following way:
    Code:
    i.sex#i.crisis
    (https://www.statalist.org/forums/for...-not-estimable & https://www.statalist.org/forums/for...fe-and-margins).

    If I follow that suggestion I still do not solve my issue (see below). I tried to rescale my variables, but that did not resolve the issue as well. Does anyone have any idea why this issue is arising?

    Code:
     xtreg workhours c.age i.sex#i.crisis, fe vce(cluster id)
    note: 2.sex#2.crisis omitted because of collinearity.
    
    Fixed-effects (within) regression               Number of obs     =    347,296
    Group variable: id                              Number of groups  =    151,470
    
    R-squared:                                      Obs per group:
         Within  = 0.0294                                         min =          1
         Between = 0.0384                                         avg =        2.3
         Overall = 0.0366                                         max =          8
    
                                                    F(3,151469)       =     860.46
    corr(u_i, Xb) = -0.1009                         Prob > F          =     0.0000
    
                                          (Std. err. adjusted for 151,470 clusters in id)
    -------------------------------------------------------------------------------------
                        |               Robust
             workhours | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------------+----------------------------------------------------------------
                    age |  -.2027896   .0151701   -13.37   0.000    -.2325227   -.1730565
                        |
            sex#crisis |
    Female#Post-crisis  |   -3.43855   .1232942   -27.89   0.000    -3.680204   -3.196896
       Male#Pre-crisis  |   4.225939   .1182001    35.75   0.000     3.994269    4.457608
      Male#Post-crisis  |          0  (omitted)
                        |
                  _cons |   47.52087   .5846898    81.28   0.000     46.37489    48.66685
    --------------------+----------------------------------------------------------------
                sigma_u |  9.4494496
                sigma_e |  6.8570233
                    rho |  .65506221   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------------
    Last edited by jad moawad; 20 Oct 2021, 08:26.

  • #2
    Someone will probably offer a better suggestion soon, but in the meantime just a quick question; have you tried
    Code:
    margins crisis##sex, noestimcheck
    ?

    Comment


    • #3
      Thank you for the help. I just tried and here is the output:

      Code:
      margins crisis##sex, noestimcheck
      
      Predictive margins                                     Number of obs = 347,296
      Model VCE: Robust
      
      Expression: Linear prediction, predict()
      
      -------------------------------------------------------------------------------------
                          |            Delta-method
                          |     Margin   std. err.      z    P>|z|     [95% conf. interval]
      --------------------+----------------------------------------------------------------
                  crisis3 |
              Pre-crisis  |   41.91534   .0647819   647.02   0.000     41.78837    42.04231
             Post-crisis  |   38.05804   .0213521  1782.40   0.000     38.01619    38.09989
                          |
                      sex |
                  Female  |   39.32812   .0669142   587.74   0.000     39.19697    39.45927
                    Male  |   38.73568   .0604256   641.05   0.000     38.61725    38.85411
                          |
              crisis#sex |
       Pre-crisis#Female  |   41.91534   .0647819   647.02   0.000     41.78837    42.04231
         Pre-crisis#Male  |   41.91534   .0647819   647.02   0.000     41.78837    42.04231
      Post-crisis#Female  |   38.47679   .0912883   421.49   0.000     38.29787    38.65571
        Post-crisis#Male  |    37.6894   .0832517   452.72   0.000     37.52623    37.85257
      -------------------------------------------------------------------------------------
      
      .
      I find it strange that the Pre-crisis#Female and Pre-crisis#Male are both equal to 41.91. What do you think?
      Last edited by jad moawad; 20 Oct 2021, 08:43.

      Comment


      • #4
        I reran the analysis using an imputed dependent variable (work hours) which have a different distribution. The code suggested by Maxence works, but again I have two outputs that have the same predicted probabilities: Pre-crisis#Female | 37.24737 & Post-crisis#Male | 37.24737. Is that normal?

        Code:
        margins crisis##sex_male, noestimcheck
        
        Predictive margins                                     Number of obs = 363,547
        Model VCE: Robust
        
        Expression: Linear prediction, predict()
        
        -------------------------------------------------------------------------------------
                            |            Delta-method
                            |     Margin   std. err.      z    P>|z|     [95% conf. interval]
        --------------------+----------------------------------------------------------------
                    crisis3 |
                Pre-crisis  |   37.88177   .0711829   532.18   0.000     37.74226    38.02129
               Post-crisis  |    37.0759   .0224228  1653.49   0.000     37.03195    37.11984
                            |
                   sex_male |
                    Female  |   36.96993   .0553663   667.73   0.000     36.86142    37.07845
                      Male  |   37.53386    .049848   752.97   0.000     37.43616    37.63156
                            |
           crisis3#sex_male |
         Pre-crisis#Female  |   37.24737   .0483227   770.81   0.000     37.15266    37.34208
           Pre-crisis#Male  |   38.44478   .1217489   315.77   0.000     38.20615     38.6834
        Post-crisis#Female  |   36.88268   .0854087   431.84   0.000     36.71528    37.05007
          Post-crisis#Male  |   37.24737   .0483227   770.81   0.000     37.15266    37.34208
        -------------------------------------------------------------------------------------

        Comment

        Working...
        X