Announcement

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

  • Time Fixed Effects and Time trends

    Dear all,

    I want to run some regressions with year, industry and country fixed effects. However, I would like to include a time trend in each regression. The process goes as follows, I want to estimate how the shares of employment in high tech industries are explained by the level of human capital within the country. My data is:

    Code:
     * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float country1 int year str2 isic float tech_intensity long Employment float(share_emp hc)
    8 1985 "15" 1     .           . 2.2555776
    8 1986 "15" 1     .           .   2.30544
    8 1987 "15" 1     .           . 2.3564048
    8 1988 "15" 1 28488     .124983  2.408496
    8 1989 "15" 1 33285   .13802098  2.461739
    8 1990 "15" 1 34191   .13564035  2.516159
    8 1993 "15" 1 15100    .2557978 2.5148826
    8 1994 "15" 1  7220    .1970309  2.514457
    8 1995 "15" 1  4515    .2089407  2.514032
    8 1996 "15" 1  5836   .24414323 2.5811894
    8 1997 "15" 1  8599    .3785937  2.634504
    8 1998 "15" 1  4316   .11582224   2.68892
    8 1999 "15" 1  4032   .13085386   2.74446
    8 2000 "15" 1  3919   .12122993 2.8011475
    8 2001 "15" 1  3144   .10250057   2.81509
    8 2002 "15" 1  3790   .10898948 2.8291016
    8 2003 "15" 1  3965   .10707534  2.843183
    8 2004 "15" 1  4599   .12050308  2.857335
    8 2005 "15" 1  5230   .13512117  2.871557
    8 2006 "15" 1  5503   .13065362  2.878032
    8 2007 "15" 1  6532   .13651279 2.8845215
    8 2008 "15" 1  6243    .1298569 2.8910255
    8 2009 "15" 1  6832   .14407423 2.8975446
    8 2010 "15" 1  7208   .13335307  2.904078
    8 2011 "15" 1  7804   .14119776 2.9106934
    8 2012 "15" 1  8202   .14464334  2.917346
    8 2013 "15" 1  8784   .14344972  2.924037
    8 2014 "15" 1  8970   .13227747  2.930766
    8 2015 "15" 1 11287   .15261777 2.9375334
    8 2016 "15" 1 14582   .16869505  2.944339
    8 2017 "15" 1 15307   .16537024  2.951184
    8 2018 "15" 1 16373    .1655996 2.9580684
    8 2019 "15" 1 17426    .1656039  2.964992
    8 1985 "16" 1     .           . 2.2555776
    8 1986 "16" 1     .           .   2.30544
    8 1987 "16" 1     .           . 2.3564048
    8 1988 "16" 1     .           .  2.408496
    8 1989 "16" 1     .           .  2.461739
    8 1990 "16" 1     .           .  2.516159
    8 1993 "16" 1  2253   .03816639 2.5148826
    8 1994 "16" 1  1311  .035776664  2.514457
    8 1995 "16" 1   976   .04516637  2.514032
    8 1996 "16" 1  2148   .08985944 2.5811894
    8 1997 "16" 1  1946    .0856778  2.634504
    8 1998 "16" 1  1399   .03754294   2.68892
    8 1999 "16" 1  1137   .03690001   2.74446
    8 2000 "16" 1   899   .02780957 2.8011475
    8 2001 "16" 1   546  .017800672   2.81509
    8 2002 "16" 1   418  .012020475 2.8291016
    8 2003 "16" 1   374  .010099919  2.843183
    8 2004 "16" 1   253   .00662911  2.857335
    8 2005 "16" 1   240  .006200589  2.871557
    8 2006 "16" 1   188 .0044635436  2.878032
    8 2007 "16" 1   174 .0036364396 2.8845215
    8 2008 "16" 1   147  .003057659 2.8910255
    8 2009 "16" 1   123  .002593842 2.8975446
    8 2010 "16" 1   185   .00342263  2.904078
    8 2011 "16" 1   104  .001881672 2.9106934
    8 2012 "16" 1    92  .001622432  2.917346
    8 2013 "16" 1   144  .002351635  2.924037
    8 2014 "16" 1   273  .004025836  2.930766
    8 2015 "16" 1     .           . 2.9375334
    8 2016 "16" 1     .           .  2.944339
    8 2017 "16" 1     .           .  2.951184
    8 2018 "16" 1     .           . 2.9580684
    8 2019 "16" 1     .           .  2.964992
    8 1985 "17" 1     .           . 2.2555776
    8 1986 "17" 1     .           .   2.30544
    8 1987 "17" 1     .           . 2.3564048
    8 1988 "17" 1 61728   .27081406  2.408496
    8 1989 "17" 1 65344   .27095816  2.461739
    8 1990 "17" 1 73034   .28973582  2.516159
    8 1993 "17" 1  7946   .13460724 2.5148826
    8 1994 "17" 1  3338   .09109268  2.514457
    8 1995 "17" 1   172  .007959646  2.514032
    8 1996 "17" 1   106 .0044344044 2.5811894
    8 1997 "17" 1   960   .04226654  2.634504
    8 1998 "17" 1 10082   .27055603   2.68892
    8 1999 "17" 1  8223   .26686788   2.74446
    8 2000 "17" 1  8717   .26965076 2.8011475
    8 2001 "17" 1  8562     .279138   2.81509
    8 2002 "17" 1 11638    .3346753 2.8291016
    8 2003 "17" 1 10479   .28298676  2.843183
    8 2004 "17" 1 10213    .2676012  2.857335
    8 2005 "17" 1 10018   .25882292  2.871557
    8 2006 "17" 1  9807    .2328403  2.878032
    8 2007 "17" 1 12639   .26414344 2.8845215
    8 2008 "17" 1 13162   .27377486 2.8910255
    8 2009 "17" 1 11845    .2497891 2.8975446
    8 2010 "17" 1 14105    .2609524  2.904078
    8 2011 "17" 1 14172   .25641397 2.9106934
    8 2012 "17" 1 15088   .26607883  2.917346
    8 2013 "17" 1 15873   .25921872  2.924037
    8 2014 "17" 1 18485   .27259186  2.930766
    8 2015 "17" 1   981  .013264644 2.9375334
    8 2016 "17" 1   991    .0114646  2.944339
    8 2017 "17" 1  1449  .015654372  2.951184
    8 2018 "17" 1  1943   .01965187 2.9580684
    8 2019 "17" 1  2068   .01965275  2.964992
    8 1985 "18" 1     .           . 2.2555776
    end
    I would like to include not only year fixed effects but also a time trend (this shares of employment are expected to follow a linear trend over time). So, far the specifications without time trends go as follows:

    Code:
     reg share_emp hc resources i.year i.country1 i.isic1 if tech_intensity==1,robust
    Code:
     reg share_emp hc resources i.year i.country1 i.isic1 if tech_intensity==3,robust
    How could I include the time trend in these regressions? Thank you!

  • #2
    Is this really your data set? It looks like the country code is repeated, which is not going to allow you to include country fixed effects. Besides that, once you include a full set of year fixed effects any trend is redundant -- unless you allow it to vary with, say, country. Then add i.country1#c.year to allow for country-specific trends.

    Comment


    • #3
      Jeff Wooldridge would it be the one way # or two way ##?

      I was always under the impression unit specific trends was i.unit##.c.time

      Comment


      • #4
        Jeff Wooldridge would it be the one way # or two way ##?

        I was always under the impression unit specific trends was i.unit##.c.time

        Comment


        • #5
          Originally posted by Jeff Wooldridge View Post
          Is this really your data set? It looks like the country code is repeated, which is not going to allow you to include country fixed effects. Besides that, once you include a full set of year fixed effects any trend is redundant -- unless you allow it to vary with, say, country. Then add i.country1#c.year to allow for country-specific trends.
          The data on human capital is at the country level, the shares of employment are at the industry level (share employment of industry i in manufacturing). The purpose is to explore how human capital (represented by a index) affects the allocation of workers across industries in manufacturing. Countries and industries are represented by numbers. It allowed me to include country fixed effects (I guess with dataex, we only get a subset of the variables to show). But here are the whole set of countries, industries, and categorizations. (I am grouping industries by three categories of technological intensity).

          Code:
           tab country1 
          
             country1 |      Freq.     Percent        Cum.              
          ------------+-----------------------------------
                    8 |        759        0.52        0.52
                   12 |      1,219        0.83        1.34
                   24 |        736        0.50        1.84
                   31 |        897        0.61        2.45
                   32 |      1,196        0.81        3.27
                   36 |      1,311        0.89        4.16
                   40 |      1,311        0.89        5.05
                   44 |        736        0.50        5.55
                   48 |        644        0.44        5.98
                   50 |      1,219        0.83        6.81
                   51 |        782        0.53        7.34
                   52 |      1,127        0.77        8.11
                   56 |      1,311        0.89        9.00
                   60 |        690        0.47        9.47
                   68 |      1,150        0.78       10.25
                   70 |        460        0.31       10.56
                   72 |        897        0.61       11.17
                   76 |      1,311        0.89       12.06
                   84 |         92        0.06       12.12
                   96 |        575        0.39       12.52
                  100 |      1,311        0.89       13.41
                  104 |        782        0.53       13.94
                  108 |        736        0.50       14.44
                  112 |        555        0.38       14.81
                  116 |        253        0.17       14.99
                  120 |        690        0.47       15.45
                  124 |      1,311        0.89       16.35
                  132 |        161        0.11       16.45
                  140 |        483        0.33       16.78
                  144 |      1,242        0.84       17.63
                  152 |      1,311        0.89       18.52
                  156 |        966        0.66       19.17
                  158 |      1,081        0.73       19.91
                  170 |      1,311        0.89       20.80
                  178 |        667        0.45       21.25
                  188 |      1,311        0.89       22.14
                  191 |        805        0.55       22.69
                  196 |      1,311        0.89       23.58
                  203 |        920        0.62       24.20
                  204 |        184        0.12       24.33
                  208 |      1,311        0.89       25.22
                  214 |      1,288        0.87       26.10
                  218 |      1,311        0.89       26.99
                  222 |      1,127        0.77       27.75
                  231 |        598        0.41       28.16
                  233 |        805        0.55       28.70
                  242 |      1,173        0.80       29.50
                  246 |      1,311        0.89       30.39
                  250 |      1,311        0.89       31.28
                  266 |        460        0.31       31.60
                  268 |        506        0.34       31.94
                  270 |        345        0.23       32.17
                  275 |        598        0.41       32.58
                  276 |        667        0.45       33.03
                  288 |      1,196        0.81       33.85
                  300 |      1,311        0.89       34.74
                  320 |      1,150        0.78       35.52
                  332 |      1,104        0.75       36.27
                  340 |      1,196        0.81       37.08
                  344 |      1,081        0.73       37.81
                  348 |      1,311        0.89       38.70
                  352 |      1,219        0.83       39.53
                  356 |      1,311        0.89       40.42
                  360 |      1,150        0.78       41.20
                  364 |      1,311        0.89       42.09
                  368 |      1,081        0.73       42.83
                  372 |      1,311        0.89       43.72
                  376 |      1,311        0.89       44.61
                  380 |      1,265        0.86       45.47
                  384 |      1,265        0.86       46.33
                  388 |        943        0.64       46.97
                  392 |      1,311        0.89       47.86
                  398 |        690        0.47       48.33
                  400 |      1,242        0.84       49.17
                  404 |      1,311        0.89       50.06
                  410 |      1,311        0.89       50.95
                  414 |      1,219        0.83       51.78
                  417 |        759        0.52       52.30
                  418 |        460        0.31       52.61
                  422 |        368        0.25       52.86
                  426 |        897        0.61       53.47
                  428 |        782        0.53       54.00
                  430 |        322        0.22       54.22
                  440 |        644        0.44       54.66
                  442 |        897        0.61       55.27
                  446 |        966        0.66       55.92
                  450 |        644        0.44       56.36
                  454 |      1,196        0.81       57.17
                  458 |      1,196        0.81       57.99
                  462 |        552        0.37       58.36
                  470 |      1,311        0.89       59.25
                  480 |      1,196        0.81       60.06
                  484 |        897        0.61       60.67
                  496 |        897        0.61       61.28
                  498 |        782        0.53       61.81
                  499 |        345        0.23       62.05
                  504 |      1,012        0.69       62.74
                  508 |        805        0.55       63.28
                  512 |        621        0.42       63.70
                  516 |        897        0.61       64.31
                  524 |        506        0.34       64.66
                  528 |      1,311        0.89       65.55
                  531 |        299        0.20       65.75
                  533 |        161        0.11       65.86
                  554 |      1,311        0.89       66.75
                  558 |      1,150        0.78       67.53
                  562 |        690        0.47       68.00
                  566 |        989        0.67       68.67
                  578 |      1,311        0.89       69.56
                  586 |        943        0.64       70.20
                  590 |      1,288        0.87       71.08
                  600 |      1,219        0.83       71.91
                  604 |      1,058        0.72       72.63
                  608 |      1,311        0.89       73.52
                  616 |      1,311        0.89       74.41
                  620 |      1,311        0.89       75.30
                  634 |        759        0.52       75.81
                  642 |      1,311        0.89       76.70
                  643 |        667        0.45       77.16
                  646 |        230        0.16       77.31
                  662 |        161        0.11       77.42
                  682 |        759        0.52       77.94
                  686 |      1,058        0.72       78.66
                  688 |        690        0.47       79.13
                  702 |      1,311        0.89       80.02
                  703 |        690        0.47       80.48
                  704 |        506        0.34       80.83
                  705 |        897        0.61       81.44
                  710 |      1,311        0.89       82.33
                  716 |        989        0.67       83.00
                  724 |      1,311        0.89       83.89
                  736 |        322        0.22       84.11
                  740 |      1,012        0.69       84.80
                  748 |        782        0.53       85.33
                  752 |      1,311        0.89       86.22
                  756 |        897        0.61       86.83
                  760 |      1,127        0.77       87.59
                  762 |        667        0.45       88.05
                  764 |      1,035        0.70       88.75
                  780 |      1,219        0.83       89.58
                  784 |        667        0.45       90.03
                  788 |      1,242        0.84       90.88
                  792 |      1,311        0.89       91.77
                  800 |      1,058        0.72       92.48
                  804 |        759        0.52       93.00
                  807 |        759        0.52       93.52
                  818 |      1,288        0.87       94.39
                  826 |      1,219        0.83       95.22
                  834 |      1,058        0.72       95.94
                  840 |      1,311        0.89       96.83
                  854 |        621        0.42       97.25
                  858 |      1,196        0.81       98.06
                  860 |        253        0.17       98.23
                  862 |        805        0.55       98.78
                  887 |        621        0.42       99.20
                  894 |      1,173        0.80      100.00
          ------------+-----------------------------------
                Total |    147,203      100.00
          Code:
          tab isic1 
          
                isic1 |      Freq.     Percent        Cum.
          ------------+-----------------------------------
                   15 |      6,401        4.35        4.35
                   16 |      6,391        4.34        8.69
                   17 |      6,391        4.34       13.03
                   18 |      6,401        4.35       17.38
                   19 |      6,401        4.35       21.73
                   20 |      6,401        4.35       26.08
                   21 |      6,401        4.35       30.43
                   22 |      6,401        4.35       34.77
                   23 |      6,401        4.35       39.12
                   24 |      6,401        4.35       43.47
                   25 |      6,401        4.35       47.82
                   26 |      6,401        4.35       52.17
                   27 |      6,401        4.35       56.52
                   28 |      6,401        4.35       60.86
                   29 |      6,401        4.35       65.21
                   30 |      6,401        4.35       69.56
                   31 |      6,401        4.35       73.91
                   32 |      6,401        4.35       78.26
                   33 |      6,401        4.35       82.61
                   34 |      6,401        4.35       86.95
                   35 |      6,401        4.35       91.30
                   36 |      6,401        4.35       95.65
                   37 |      6,401        4.35      100.00
          ------------+-----------------------------------
                Total |    147,203      100.00
          In this case, I am in doubt whether introducing year fixed effects or a time trend. Many industries show increasing shares of employment over time and vice-versa.

          Code:
          tab tech_intensity
          
          tech_intens |
                  ity |      Freq.     Percent        Cum.
          ------------+-----------------------------------
                    1 |     51,188       34.77       34.77
                    2 |     32,005       21.74       56.52
                    3 |     64,010       43.48      100.00
          ------------+-----------------------------------
                Total |    147,203      100.00





          Comment


          • #6
            Originally posted by Jared Greathouse View Post
            Jeff Wooldridge would it be the one way # or two way ##?

            I was always under the impression unit specific trends was i.unit##.c.time
            I thought the same but apparently those are not working on my regressions

            Comment


            • #7
              any hope? XD

              Comment

              Working...
              X