Announcement

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

  • xtreg with year dummy using lagged independent variables

    Hello everyone,

    - I am using Stata 13.1 and dealing with panel data for years 1999 to 2015 for 31 provinces.
    - dependent variable is defined over years 1999 to 2015
    - 11 independent variables: 7 independent variables are included as first lag (from which I have data from 1999 to 2014), 2 are not lagged (EMCO1 and POCO1). Also, there is one dummy variable (EAST) and one constant variable (area_share). The latter two are only interesting in the OLS Regression and omitted in xtreg.


    My question: why are three and not two years excluded by xtreg i.year? Is it even possible to include only two non-lagged independent variables (POCO1 and EMCO1) as the rest of the independent variables are lagged?

    Using this code, year 1999, 2000 and 2015 were excluded. I expected only 1999 and one randomly selected year due to the year dummy should be excluded.

    (1)
    Code:
    xtset province_id year
    xtreg lnFINPP_PY lnGRPpc_L rSTBDGT_L lnTOPOP_L rFRBDGT_L lnOPEN_L rEDU_L UNEMPLR_L EMCO1 POCO1 area_share EAST i.year, cluster(province_id) fe
    I did not know how to check on my mistake, so I tried including the constant (and later also the dummy) as lagged variable assuming that the results will not change. But they did: Only two years are missing and not three. Please, where is my mistake?

    (2)
    Code:
    xtreg lnFINPP_PY lnGRPpc_L rSTBDGT_L lnTOPOP_L rFRBDGT_L lnOPEN_L rEDU_L UNEMPLR_L EMCO1 POCO1 L.area_share EAST i.year, cluster(province_id) fe

    Data:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float province_id int year float(lnFINPP_PY lnGRPpc_L rSTBDGT_L lnTOPOP_L rFRBDGT_L lnOPEN_L rEDU_L UNEMPLR_L) double(EMCO1 POCO1) float(area_share EAST)
    1 1999 11.569733          .         .         .         .          .         .   . 0  0 1.45 0
    1 2000 11.569733  -3.257819 1.3704035  8.738255 .26987764  -1.703933  .7275934 3.2 0  0 1.45 0
    1 2001 11.671157  -3.214492 1.5047776  8.714896 .51101106 -1.3589847  .8885607 3.3 0  0 1.45 0
    1 2002 11.612022  -3.100592   1.96753  8.720624 .17494632 -1.3197136 1.0497715 3.7 1  0 1.45 0
    1 2003 11.986628  -3.028894 2.2078462  8.723231  .6531769 -1.1461267  1.256022   4 1  0 1.45 0
    1 2004 12.034895  -2.909806 1.5686533  8.726319  .5702108  -.9648787 1.4601655 4.1 1  0 1.45 0
    1 2005 12.100407 -2.7219214  1.825899  8.736811  .6047108  -.8010825 1.6862556 4.2 1  0 1.45 0
    1 2006 11.586026  -2.619497 2.2522647  8.719317  .8657669  -.7130618 1.9101307 4.4 1  0 1.45 0
    1 2007 11.418112   -2.48467 2.7527194  8.717682  .9346421 -2.7088826 2.1078558 4.3 3  1 1.45 0
    1 2008  12.18071  -2.480145  3.603626   8.71899 1.1563771  -2.234027 2.2090552 4.1 3  1 1.45 0
    1 2009  12.12102 -2.2888815  3.278255 8.7217655 1.0541526 -1.6444767 2.1794622 3.9 3  1 1.45 0
    1 2010 12.000088 -2.1825845  4.997108  8.721113  .8343586 -2.2484758  2.129669 3.9 3  1 1.45 0
    1 2011  11.88354  -1.973609  5.256758  8.692323  .8010144 -1.5219986 2.1420178 3.7 3  1 1.45 0
    1 2012 11.865045 -1.8203557 4.5822244  8.694167   .694611  -1.290984 2.1429288 3.7 4  1 1.45 0
    1 2013 11.822655 -1.7411414  5.015033  8.697513  .6474533 -1.1949058 2.1591516 3.7 3  1 1.45 0
    1 2014 11.782945 -1.6416317  4.885972  8.704502 .55836546 -1.0613165 2.0814261 3.4 3  1 1.45 0
    1 2015 11.776844 -1.5476193  5.600096  8.713253   .397242 -1.0488584  1.974848 3.2 3  1    . 0
    2 1999 11.299896          .         .         .         .          .         .   . 0  3  .17 1
    2 2000  12.09661 -1.6970663  5.110459  7.136483 1.2871338 -1.1976634  1.284805  .6 0  3  .17 1
    2 2001  12.09661  -1.595599 3.3615255  7.218177  .4557733 -1.0230772 1.3123167  .8 0  3  .17 1
    2 2002  12.09661  -1.474986  3.640277  7.233455  .4145136  -.9626557  1.402888 1.2 0 10  .17 1
    2 2003  12.02915 -1.3468436  2.513789  7.260522  .5654693  -.9622037 1.5509486 1.4 0  8  .17 1
    2 2004  12.02915 -1.2099323  1.565942  7.283448 1.0506849  -.8142184  1.723901 1.4 0  8  .17 1
    2 2005 12.003208 -1.0446875 1.8335183  7.308543 1.9318075  -.6797218 1.8405894 1.3 0  8  .17 1
    2 2006 11.907513  -.9628851  1.751053  7.338238   .990312  -2.578607  1.810143 2.1 0  8  .17 1
    2 2007 11.037967  -.8895718  1.293457  7.378384  .9266079 -2.1764178 1.6202374   2 0 13  .17 1
    2 2008 11.037967  -.8723533  .7539498  7.424165  .8102116 -1.9370425  1.454654 1.8 0  8  .17 1
    2 2009 11.037967  -.7929118  .8046785    7.4793  .7085021  -1.438501 1.2377188 1.8 0  8  .17 1
    2 2010  7.463375  -.7765567  .7966737  7.528332  .3098815 -1.6045997  1.094086 1.4 0  8  .17 1
    2 2011  7.463375  -.7106667    .62493   7.58172 .30892235 -1.2727828 1.0112131 1.4 0  8  .17 1
    2 2012  7.463375  -.6627104  .4351484  7.610358 .18120927 -1.1809075    .96632 1.4 0 12  .17 1
    2 2013  9.875608  -.6298859  .6800004   7.63482 .12405337 -1.1289479  .9352344 1.3 0  8  .17 1
    2 2014  9.836048  -.5572342 4.2486644   7.65681  .1186315 -1.0847094  .8869976 1.2 0  8  .17 1
    2 2015  9.875758  -.4812823 4.0278788  7.674153 .13501585  -1.107184  .8252788 1.3 0  8    . 1
    3 1999 10.772248          .         .         .         .          .         .   . 0  0  .86 0
    3 2000  11.28726  -3.002237   2.69721   8.03106 .42809045  -5.264979  .6078049 3.5 0  0  .86 0
    3 2001  11.28726  -3.053104  3.248464  7.954723  .2305974  -3.458387  .7402598 3.5 0  0  .86 0
    3 2002   11.2997 -2.9431396 3.5338874  7.947679  .4006354  -3.328886  .9027925 3.9 0  0  .86 0
    3 2003   11.2997  -2.822345  5.418163  7.942362  .6166978  -3.423394 1.1869226 4.1 0  0  .86 0
    3 2004  11.02772 -2.6714375  4.088085  7.938446  .5849624 -1.7223837 1.4552265 4.1 0  0  .86 0
    3 2005 11.391273  -2.496411  3.033369  7.934872 1.5639727 -1.2831402 1.6208378 4.1 0  0  .86 0
    3 2006 11.344135 -2.3831084  3.344849   7.93666 1.2377008 -1.1332796 1.7205147 4.1 0  0  .86 0
    3 2007  11.32537 -2.2709696   3.34892  7.940228  .7148287  -.9733627 1.8023504   4 0  1  .86 0
    3 2008 11.454132 -2.1571486  3.995612  7.943073 2.0251791  -.8269225 1.8384233   4 0  1  .86 0
    3 2009 11.413807 -1.9395006 2.9687624  7.951207 1.2220254  -.7050514 1.9633675   4 0  1  .86 0
    3 2010 12.229894 -1.8483436  5.223422  7.958227 1.0810091  -.8106477 2.0706542   4 0  1  .86 0
    3 2011  12.17822  -1.695113  6.722537   7.96728  1.863586  -2.704198 2.1712306 3.9 0  1  .86 0
    3 2012 12.876143 -1.5242908  5.421136  7.978996 1.0848665 -1.4312917 2.2223365 3.5 0  1  .86 0
    3 2013 12.799463  -1.439885  3.607313  7.987864 .52490884  -.9927605  2.240068 3.3 0  1  .86 0
    3 2014 12.759786  -1.341026  5.487255  7.996317   .736119  -.8439701  2.226936 3.4 0  1  .86 0
    3 2015 12.757065 -1.2183313  5.424397  8.003363  1.980284  -.7168478  2.166165 3.5 0  1    . 0
    4 1999 10.960018          .         .         .         .          .         .   . 0  0 1.29 1
    4 2000 10.960018   -2.42641 1.0769758  8.106515  1.409412 -2.0381353  .9282268 2.2 0  0 1.29 1
    4 2001 10.960018 -2.3633456 1.0524526  8.134467 1.0211077  -1.629684 1.0920821 2.6 0  0 1.29 1
    4 2002 10.839868 -2.2948828   .975975  8.144679  1.387726 -1.5759664 1.2783744 3.8 0  1 1.29 1
    4 2003 10.839868 -2.2154875   1.21476  8.153638 1.2355766 -1.4338087 1.4608746 4.2 0  1 1.29 1
    4 2004 10.765666 -2.0996253 1.4569587   8.16109 2.1983802 -1.1887001   1.64249 4.1 0  1 1.29 1
    4 2005 11.600473 -1.9591916  1.105954   8.16877 2.1123133 -1.0161939 1.8696516   4 0  1 1.29 1
    4 2006 11.994933 -1.8537343 2.1409094  8.176673 1.8351744  -.9372519 2.0593197   4 0  1 1.29 1
    4 2007 11.955837  -1.739911 1.7888012  8.184514  1.803833  -.8322842  2.176848 3.9 1  1 1.29 1
    4 2008 11.871795 -1.7264076  2.840343  8.192017 2.2373283  -.7998328  2.150609 3.9 1  1 1.29 1
    4 2009 11.792775 -1.5664403  3.186544  8.199464 1.8390448  -.7218233  2.057708 3.9 1  1 1.29 1
    4 2010  11.67889 -1.4706904 3.9206376  8.206857 1.5402242  -.7725692 1.9615386 3.9 1  1 1.29 1
    4 2011 11.168777 -1.3232796 4.0774593  8.214194 1.8931787  -2.966562  1.912808 3.8 1  0 1.29 1
    4 2012  10.95332 -1.2071133  4.334124  8.221479  2.204989 -2.2827826  1.907258 3.7 1  1 1.29 1
    4 2013 11.973694 -1.1354288  5.785112  8.228977 1.7860316 -2.2428744  1.842316 3.6 1  1 1.29 1
    4 2014  11.82629  -1.044459  5.865517   8.23589 1.1709999 -2.1202636 1.7395337 3.6 1  1 1.29 1
    4 2015    11.866  -.9358036  5.548027  8.244334   .778774 -2.0249774 1.6529164 3.5 1  1    . 1
    5 1999 11.545344          .         .         .         .          .         .   . 0  0 4.43 0
    5 2000 11.545344 -3.4315896 2.7595365    7.8411  .6838715 -1.0814036  .7907983 2.8 0  0 4.43 0
    5 2001 11.545344  -3.360688  3.403047  7.830028  .6306512  -.9287949  .9125249 2.7 0  0 4.43 0
    5 2002  11.53132  -3.292331 4.5247345  7.833204  .3581045  -.7705519  1.096314 2.8 0  1 4.43 0
    5 2003  11.57788  -3.213729 4.6143355   7.83637 .34333575   -.725815  1.368234 3.2 0  1 4.43 0
    5 2004 11.552352  -3.070435  4.922027  7.838737  .3943336 -4.4777803 1.6830903 3.4 0  1 4.43 0
    5 2005 11.544067 -2.8787665 4.7047954  7.840313  .6615378   -3.57829  1.966155 3.4 0  1 4.43 0
    5 2006 11.356117  -2.767534  3.754951  7.841886  .7223446 -1.7178866 2.2247543 3.3 0  1 4.43 0
    5 2007 10.108307  -2.622706  3.944936  7.842671  .6437306  -1.280517 2.3694541 3.6 0  1 4.43 0
    5 2008  11.33263  -2.606123 4.0018787  7.843064  .4149439 -1.0097018 2.4093406 3.3 0  1 4.43 0
    5 2009 11.486243  -2.440049   5.36374  7.844241  .4146115  -.8969823 2.4237554 3.2 0  1 4.43 0
    5 2010 11.466524  -2.394923  9.785508  7.845808  .4885522 -1.2981553  2.468493 3.3 0  1 4.43 0
    5 2011 11.295465 -2.2331574 11.917732  7.847763  .4465206  -.8009427  2.527344 3.2 0  1 4.43 0
    5 2012 12.447514 -2.0899756  12.44709  7.849324 .34937665  -.7700282 2.5627925 3.1 0  1 4.43 0
    5 2013   12.4698  -2.011197 11.858872  7.854769 .27591947    -.78082  2.579131 2.7 0  0 4.43 0
    5 2014  12.43009  -1.907135 14.666646  7.856319  .4789367  -3.146555 2.5817196 2.3 0  0 4.43 0
    5 2015 12.433342 -1.8117893  12.35209  7.859799  .5043281  -.7819285  2.525666 2.2 0  0    . 0
    end
    Do you know where my mistake is? How can I improve?

    Thank you and best regards

    Meimu


    P.S.:

    I should use the lag with L.var. Sorry. when I began using Stata a few week ago I only know how to create the lags by hand. Anyways, the same result as in (1) appeared with this code

    (3)
    Code:
    xtreg lnFINPP_PY L.GRPpc L.rSTBDGT L.lnTOPOP L.rFRBDGT L.lnOPEN L.rEDU L.UNEMPLR EMCO1 POCO1 area_share EAST i.year, cluster(province_id) fe
    Last edited by Meimu Fen; 17 Oct 2016, 08:38.

  • #2
    Your area_share variable has missing values for the final year (2015). Therefore, this year is not used for the estimation. However, the lag of area_share exists in the year 2015 because all observations are moved one year forward.
    https://www.kripfganz.de/stata/

    Comment


    • #3
      Meimu,

      Sebastian already pointed out why you are missing a year.

      Is it even possible to include only two non-lagged independent variables (POCO1 and EMCO1) as the rest of the independent variables are lagged?
      There is no general objection of using lagged and non-lagged variables in the same equation - in fact, this is quite common. It is even possible to include both a lagged and a non-lagged value of the same variable. Which variables you should include (lagged, non-lagged, or both) depends on you theoretical model.

      I should use the lag with L.var. Sorry. when I began using Stata a few week ago I only know how to create the lags by hand.
      For your estimation, it does not matter whether you create an extra variable or if you use Stata's special notation for lagged values. However, I would advise you to use the special notation instead of separate variables because in this case Stata knows that the lagged variable is derived from another non-lagged variable. Therefore, Stata will combine both variables for further computations if necessary. It is also less prone to errors than creating the lags by yourself.

      Comment


      • #4
        Thank you both Sebastian and Sebastian!

        You are right, Sebastian, I should use Stata's notation for lagged valued. I think the reason I oversaw this obvious mistake is because I simply had too many variable columns to clearly see some mistakes.

        Thank you again!

        Comment

        Working...
        X