Announcement

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

  • Adding linear time trends (dropped)

    Dear Statalist Users,

    I have the following data. This dataset is at city level.

    Plate=unique identifier of each province There are 81 provinces in this dataset.
    Child Birth Year= It spans from 2003 to 2018. Indeed, they are just years.
    Refugee Ratio= It is the number of refugees in each province divided by its own population. It takes 0 from 2003 to 2012 due to absence of refugees. Then, after 2013, it starts taking its values.
    Region 5= It is region dummies. 1 includes provinces in North, 2 includes provinces in South, 3 includes provinces in West, 4 provinces cities in East, and 5 provinces cities in Central.
    Instrument= It is an IV.
    Log GDP Interpolated= GDP per capita at province level (only year 2003 is interpolated).

    For example, when I try to look at the effect of refugees on GDP, I run the following codes to replicate the study I attached here:

    (1) To include province and year FEs, I think it's okay. I replicate the author's Column (4) here.

    ivreg2 log_gdp_interpolated ( refugeeratio =instrument_) i.plate i.child_birth_year, cluster(plate)

    (2) To include province FE, year FE, and 5 Region Linear Time Trends, the regression says "Dropped collinear: 2.region5 3.region5 4.region5 5.region5. Here is the code I use.

    ivreg2 log_gdp_interpolated ( refugeeratio =instrument_) i.plate i.child_birth_year i.region5, cluster(plate)

    As you can see, I have just include region5 dummies. I also tried it without "i." and it was dropped again. So my question, how can I include the "5 Region Linear Time Trends" as the authors add as in their Column (5).

    (3) Similarly, is this correct to replicate their Column (6) using the following code?

    ivreg2 log_gdp_interpolated ( refugeeratio =instrument_) i.plate i.child_birth_year i.region5#i.child_birth_year, cluster(plate)

    Thank you very much in advanced.

    Click image for larger version

Name:	FEs.png
Views:	1
Size:	104.0 KB
ID:	1669876



    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte plate int child_birth_year float(region5 refugeeratio) double instrument_ float log_gdp_interpolated
    1 2003 2            0                  0  8.098686
    1 2004 2            0                  0   8.35625
    1 2005 2            0                  0  8.560877
    1 2006 2            0                  0 8.6270895
    1 2007 2            0                  0  8.833439
    1 2008 2            0                  0  8.950308
    1 2009 2            0                  0  8.775798
    1 2010 2            0                  0  8.951138
    1 2011 2            0                  0   8.99517
    1 2012 2            0                  0  9.039643
    1 2013 2    .00899705  2137.502174204115  9.113099
    1 2014 2   .028272137  7725.103785707176  9.062313
    1 2015 2    .06261454  9552.797764008226  8.977292
    1 2016 2     .0680111 10815.378820879647  8.983587
    1 2017 2    .07022186  11869.59208789388  8.932284
    1 2018 2    .08672575  13611.10083198924   8.81266
    2 2003 5            0                  0   7.53345
    2 2004 5            0                  0  7.804962
    2 2005 5            0                  0  8.018276
    2 2006 5            0                  0  8.095382
    2 2007 5            0                  0  8.301027
    2 2008 5            0                  0 8.4515085
    2 2009 5            0                  0   8.24615
    2 2010 5            0                  0  8.475749
    2 2011 5            0                  0  8.558379
    2 2012 5            0                  0  8.554743
    2 2013 5   .017068442 1873.8649676118544   8.62631
    2 2014 5    .05579131  6772.297838991608   8.59959
    2 2015 5   .036632303  8374.566018545016   8.50638
    2 2016 5    .04061859  9481.421693263867  8.488602
    2 2017 5    .04283048 10405.609435989865  8.441897
    2 2018 5    .04727203 11932.322374920604  8.375801
    3 2003 3            0                  0  8.039925
    3 2004 3            0                  0  8.265195
    3 2005 3            0                  0  8.448931
    3 2006 3            0                  0   8.52808
    3 2007 3            0                  0  8.732327
    3 2008 3            0                  0  8.862084
    3 2009 3            0                  0  8.706999
    3 2010 3            0                  0  8.930561
    3 2011 3            0                  0  8.954763
    3 2012 3            0                  0  8.963824
    3 2013 3            0  775.6147412650209  9.015151
    3 2014 3  .0007078433  2803.133697970472   9.02242
    3 2015 3  .0040069674  3466.331335474366  8.934076
    3 2016 3   .005851456  3924.471912625391  8.944426
    3 2017 3   .006891223  4307.004085084045   8.93551
    3 2018 3   .008190825  4938.928520185606  8.804566
    4 2003 5            0                  0   7.34143
    4 2004 5            0                  0  7.580326
    4 2005 5            0                  0  7.773012
    4 2006 5            0                  0  7.768281
    4 2007 5            0                  0  7.943454
    4 2008 5            0                  0  8.026946
    4 2009 5            0                  0  7.925411
    4 2010 5            0                  0  8.236918
    4 2011 5            0                  0  8.225596
    4 2012 5            0                  0  8.267767
    4 2013 5            0  801.6362469490603  8.292835
    4 2014 5 .00018200515   2897.17750035604 8.2031765
    4 2015 5  .0014546518  3582.625103178801  8.123725
    4 2016 5  .0015804373 4056.1360787997937  8.203612
    4 2017 5  .0018795975   4451.50202371064  8.111795
    4 2018 5  .0021050407  5104.627223064127  8.006121
    5 2003 3            0                  0  8.037372
    5 2004 3            0                  0  8.316185
    5 2005 3            0                  0  8.533969
    5 2006 3            0                  0  8.565304
    5 2007 3            0                  0  8.739339
    5 2008 3            0                  0   8.95324
    5 2009 3            0                  0  8.813373
    5 2010 3            0                  0  8.976414
    5 2011 3            0                  0  9.006424
    5 2012 3            0                  0  9.049225
    5 2013 3            0  892.4989384510496  9.091903
    5 2014 3  .0003106429  3225.562533397196  9.035556
    5 2015 3  .0004469732  3988.703247419831  8.994672
    5 2016 3  .0006649282  4515.885051754473 8.9999695
    5 2017 3  .0012185954  4956.064356863975   8.93685
    5 2018 3   .001688849   5683.21903495784  8.793315
    6 2003 3            0                  0  8.820829
    6 2004 3            0                  0  9.080735
    6 2005 3            0                  0  9.286835
    6 2006 3            0                  0  9.369869
    6 2007 3            0                  0  9.585378
    6 2008 3            0                  0  9.712936
    6 2009 3            0                  0  9.521501
    6 2010 3            0                  0  9.652315
    6 2011 3            0                  0  9.694221
    6 2012 3            0                  0  9.711046
    6 2013 3            0  845.9475972730434  9.818029
    6 2014 3   .005825161 3057.3222638415114  9.750788
    6 2015 3    .01024025   3780.65875825695  9.638588
    6 2016 3   .012557893  4280.343588669125  9.655186
    6 2017 3   .014737303 4697.5638334046025  9.586901
    6 2018 3   .017472614 5386.7912669373945  9.465929
    7 2003 2            0                  0  8.747828
    7 2004 2            0                  0  8.968632
    7 2005 2            0                  0  9.149391
    7 2006 2            0                  0  9.225716
    end

  • #2
    Cansu:
    as the community-contributed module (as per FAQ you're kindly requested to define it) -ivreg2- does not support -fvvarlist- notation, in the following toy-example concerning regional time-trend code I switched to -ivregress-:
    Code:
    . ivregress 2sls log_gdp_interpolated ( refugeeratio =instrument_) i.plate c.child_birth_year##i.region5, cluster(plate)
    note: 3.region5 omitted because of collinearity.
    note: 5.region5 omitted because of collinearity.
    
    Instrumental variables 2SLS regression            Number of obs   =        100
                                                      Wald chi2(10)   =   19523.03
                                                      Prob > chi2     =     0.0000
                                                      R-squared       =     0.8872
                                                      Root MSE        =     .18178
    
                                                    (Std. err. adjusted for 7 clusters in plate)
    --------------------------------------------------------------------------------------------
                               |               Robust
          log_gdp_interpolated | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    ---------------------------+----------------------------------------------------------------
                  refugeeratio |  -15.27605   4.257833    -3.59   0.000    -23.62125   -6.930847
                               |
                         plate |
                            2  |   105.4873   58.61178     1.80   0.072     -9.38971    220.3642
                            3  |   152.2969   43.39097     3.51   0.000     67.25212    237.3416
                            4  |   104.9493   58.56934     1.79   0.073    -9.844492    219.7431
                            5  |   152.3236   43.38531     3.51   0.000     67.28999    237.3573
                            6  |   153.0968    43.4003     3.53   0.000     68.03382    238.1599
                            7  |   .6648572   .0553665    12.01   0.000     .5563408    .7733735
                               |
              child_birth_year |   .1281603   .0236243     5.42   0.000     .0818576    .1744631
                               |
                       region5 |
                            3  |          0  (omitted)
                            5  |          0  (omitted)
                               |
    region5#c.child_birth_year |
                            3  |  -.0759233   .0216216    -3.51   0.000    -.1183009   -.0335457
                            5  |  -.0527568   .0291605    -1.81   0.070    -.1099103    .0043968
                               |
                         _cons |  -248.5394   47.41022    -5.24   0.000    -341.4617    -155.617
    --------------------------------------------------------------------------------------------
    Instrumented: refugeeratio
     Instruments: 2.plate 3.plate 4.plate 5.plate 6.plate 7.plate child_birth_year
                  3.region5#c.child_birth_year 5.region5#c.child_birth_year instrument_
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Cansu:
      as the community-contributed module (as per FAQ you're kindly requested to define it) -ivreg2- does not support -fvvarlist- notation, in the following toy-example concerning regional time-trend code I switched to -ivregress-:
      Code:
      . ivregress 2sls log_gdp_interpolated ( refugeeratio =instrument_) i.plate c.child_birth_year##i.region5, cluster(plate)
      note: 3.region5 omitted because of collinearity.
      note: 5.region5 omitted because of collinearity.
      
      Instrumental variables 2SLS regression Number of obs = 100
      Wald chi2(10) = 19523.03
      Prob > chi2 = 0.0000
      R-squared = 0.8872
      Root MSE = .18178
      
      (Std. err. adjusted for 7 clusters in plate)
      --------------------------------------------------------------------------------------------
      | Robust
      log_gdp_interpolated | Coefficient std. err. z P>|z| [95% conf. interval]
      ---------------------------+----------------------------------------------------------------
      refugeeratio | -15.27605 4.257833 -3.59 0.000 -23.62125 -6.930847
      |
      plate |
      2 | 105.4873 58.61178 1.80 0.072 -9.38971 220.3642
      3 | 152.2969 43.39097 3.51 0.000 67.25212 237.3416
      4 | 104.9493 58.56934 1.79 0.073 -9.844492 219.7431
      5 | 152.3236 43.38531 3.51 0.000 67.28999 237.3573
      6 | 153.0968 43.4003 3.53 0.000 68.03382 238.1599
      7 | .6648572 .0553665 12.01 0.000 .5563408 .7733735
      |
      child_birth_year | .1281603 .0236243 5.42 0.000 .0818576 .1744631
      |
      region5 |
      3 | 0 (omitted)
      5 | 0 (omitted)
      |
      region5#c.child_birth_year |
      3 | -.0759233 .0216216 -3.51 0.000 -.1183009 -.0335457
      5 | -.0527568 .0291605 -1.81 0.070 -.1099103 .0043968
      |
      _cons | -248.5394 47.41022 -5.24 0.000 -341.4617 -155.617
      --------------------------------------------------------------------------------------------
      Instrumented: refugeeratio
      Instruments: 2.plate 3.plate 4.plate 5.plate 6.plate 7.plate child_birth_year
      3.region5#c.child_birth_year 5.region5#c.child_birth_year instrument_
      
      .
      Dear Dr Lazarro,

      Thank you very much for your kind and explanatory reply.

      There is one thing that confused my mind, even in your regression table above, Stata drops region5. To that extent, I have two questions if you do not mind. (1) The code you provided is the replication of Column (6), am I right? (2) Stata still drops region5 variable in your table, what does that mean and how can I interpret the region5#c.child_birth_year coefficients here?

      Thank you very much.

      Comment


      • #4
        Cansu:
        1) the code I provided is an attempt to replicate what in column (6) given the provided details;
        2) Region 5 is dropped due to perfcet collineraity; as the regional-specific time trend does not reach statistical significance (p-value=0.070), there's no evidence of that and you can safely ignore it.
        As an aaside there's a FAQ recommending to report full reference whe a source is quoted. Thanks.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Cansu:
          1) the code I provided is an attempt to replicate what in column (6) given the provided details;
          2) Region 5 is dropped due to perfcet collineraity; as the regional-specific time trend does not reach statistical significance (p-value=0.070), there's no evidence of that and you can safely ignore it.
          As an aaside there's a FAQ recommending to report full reference whe a source is quoted. Thanks.
          Dear Dr Lazzaro,

          The reference is as follows. Sorry for forgetting to add it. Apologies for this.
          Aygün, A., Kırdar, G. M., and Tuncay, B. (2021) . The effect of hosting 3.4 million refugees on native population mortality. Journal of Health Economics, 80(2021).

          Apart from this, for Column (6), I thought that adding "5 Region-Year Fixed Effect" should look like this : "ivregress 2sls log_gdp_interpolated ( refugeeratio =instrument_) i.plate i.child_birth_year i.region5#i.child_birth_year, cluster(plate)". But rather, you use "ivregress 2sls log_gdp_interpolated ( refugeeratio =instrument_) i.plate c.child_birth_year##i.region5, cluster(plate)". Probably I am mistaken, but I know that putting "c" ahead of a variable means that you treat this variable as a trend. So, since in Column(6), they say FE not trend. That is why I am really confused about the code. Can you please explain why you use "c.child_birth_year##i.region5" to refer "5 Region-Year Fixed Effect"? What is the difference between your code and my code?

          Second, to replicate Column (5), where they only add province FE, year FE, and 5 region linear time trend, I use the following code: ivreg2 log_gdp_interpolated ( refugeeratio =instrument_) i.plate i.child_birth_year region5, cluster(plate). However, again, Stata drops region5 due to collinearity. With and without region5, results do not change at all. So, apparently I am doing it wrong. I thought plate variable has values from 1 to 81 and region5 (taking values from 1 to 5) is constructed based on plate variable. Can it be the reason by Stata says that there exists a collinearity and thus drops it.

          Thank you in advance.

          Comment


          • #6
            Cansu:
            thankd for providing full reference.
            1) you're correct. I should have recommended:
            Code:
             
             ivregress 2sls log_gdp_interpolated ( refugeeratio =instrument_) i.plate i.child_birth_year##i.region5, cluster(plate)
            2) in your second code, I do not see regional time trend. Your suspect about perfect collinearity is possibly correct.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              Cansu:
              thankd for providing full reference.
              1) you're correct. I should have recommended:
              Code:
              ivregress 2sls log_gdp_interpolated ( refugeeratio =instrument_) i.plate i.child_birth_year##i.region5, cluster(plate)
              2) in your second code, I do not see regional time trend. Your suspect about perfect collinearity is possibly correct.
              Dear Dr Lazzaro,

              Thank you very much for your explanatory answers. It helped me figuring out.

              Comment


              • #8
                Thanks.
                Please note that Carlo is enough.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment

                Working...
                X