Announcement

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

  • Interacting country dummy with continuous variable to find country-specific slope effect in panel setup?

    In a panel setup, I am trying to regress GDP per capita growth on the change in the ratio of the population above 50 to those between the ages of 20 and 49 as I have seen in a 2017 Acemoglu, Restrepo paper (https://doi.org/10.1257/aer.p20171101).

    By using interaction terms, I am trying to find out whether different country groups, and ideally countries, have different slopes.

    When I interact with a country group dummy variable (say taking the value 1 if country belongs to Europe) everything works fine and I get a result (I included i.EUR here although I know that it will drop out due the fe estimation, i.e it is collinear with country-specific dummies).

    Code:
     xtreg D.lnYL i.EUR pop50ratio i.EUR#c.pop50ratio, fe
    However, when I interact with a country dummy, that interaction also drops out and I get the message "1.GBR#c.pop55ratio omitted because of collinearity"

    Code:
     ​​​​​​​xtreg D.lnYL i.GBR pop50ratio i.GBR#c.pop50ratio, fe
    I do not see why in the case of one country there is perfect collinearity, but in the case of country groups there is not?

  • #2
    I suspect it has something to do with something peculiar in the GBR observations themselves, perhaps something about missing values. Or perhaps your GBR variable has been incorrectly constructed (you don't show the code for that). Here's an example that is analogous to what you are doing:
    Code:
    . webuse nlswork, clear
    (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
    
    . 
    . xtset
           panel variable:  idcode (unbalanced)
            time variable:  year, 68 to 88, but with gaps
                    delta:  1 unit
    
    . 
    . gen byte EUR = mod(idcode, 2)
    
    . 
    . xtreg ln_wage i.EUR##c.tenure, fe
    note: 1.EUR omitted because of collinearity
    
    Fixed-effects (within) regression               Number of obs     =     28,101
    Group variable: idcode                          Number of groups  =      4,699
    
    R-sq:                                           Obs per group:
         within  = 0.0974                                         min =          1
         between = 0.1967                                         avg =        6.0
         overall = 0.1378                                         max =         15
    
                                                    F(2,23400)        =    1262.05
    corr(u_i, Xb)  = 0.1396                         Prob > F          =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           1.EUR |          0  (omitted)
          tenure |   .0328831   .0009613    34.21   0.000     .0309989    .0347673
                 |
    EUR#c.tenure |
              1  |   .0026037   .0013617     1.91   0.056    -.0000653    .0052727
                 |
           _cons |   1.570324   .0027933   562.17   0.000     1.564849    1.575799
    -------------+----------------------------------------------------------------
         sigma_u |  .39164104
         sigma_e |  .30355898
             rho |  .62469854   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(4698, 23400) = 7.80                 Prob > F = 0.0000
    
    . 
    . gen GBR = 1.idcode
    
    . xtreg ln_wage i.GBR##c.tenure, fe
    note: 1.GBR omitted because of collinearity
    
    Fixed-effects (within) regression               Number of obs     =     28,101
    Group variable: idcode                          Number of groups  =      4,699
    
    R-sq:                                           Obs per group:
         within  = 0.0975                                         min =          1
         between = 0.1969                                         avg =        6.0
         overall = 0.1377                                         max =         15
    
                                                    F(2,23400)        =    1263.79
    corr(u_i, Xb)  = 0.1400                         Prob > F          =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           1.GBR |          0  (omitted)
          tenure |   .0341584   .0006808    50.17   0.000     .0328239    .0354929
                 |
    GBR#c.tenure |
              1  |   .1410965   .0540935     2.61   0.009     .0350698    .2471233
                 |
           _cons |   1.570316   .0027931   562.21   0.000     1.564841     1.57579
    -------------+----------------------------------------------------------------
         sigma_u |  .39170393
         sigma_e |  .30353857
             rho |  .62480534   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(4698, 23400) = 7.80                 Prob > F = 0.0000
    As you can see, it works just as well with one "country" as it does with one "group of countries." Perhaps if you post an example of your data that exhibits this problem, an explanation can be found. (Use the -dataex- command to do that, please.)

    Comment


    • #3
      Thank you very much for your example Clyde. It is very helpful! There was indeed a problem with the construction of the interaction variable.

      Comment

      Working...
      X