Announcement

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

  • Panel data set - country-fixed effects and country-specific (linear) time trends

    I have read the paragraph below in an economic journal and would like to do something similar within Stata.

    "All model specifications include country-fixed effects to capture the effects of within-country changes in leave duration. Time dummies and country-specific (linear) time trends are also added to eliminate the effect of exogenous factors on (changes in) labour market outcomes."

    I have a cross-country panel data set and plan to use a fixed-effects model. Does declaring my panel data set as 'xtset country year' mean I have included the country-specific (linear) time trends or would this be another variable? If so, how would I go about it?

    Thank you.

  • #2
    -xtset country year- will automatically include country fixed effects in any -xt- regression command. But it will not incorporate time effects in any way.

    So in your model, if you want to model a linear time trend, you need to include year as one of the predictor variables in your model. Just add it to the list of predictor variables in the regression command, e.g. -xtreg outcome predictor1 predictor2 year, fe-.

    Comment


    • #3
      Thank you for your help, Clyde.

      Comment


      • #4
        I have another question. What would make the variable a country-specific time trend? Would I replace the 'year' independent variable with an interaction variable of 'year x country'?

        Comment


        • #5
          Yes, if you want each country to have its own time trend, you include a year X country interaction. Use factor variable notation and make sure you specify it as c.year##i.country. The i.country main effect will not appear if you are using -xtreg, fe- (or any other -xt...,fe-). But the interaction terms will. Then to get the actual marginal effects of time in each year, use -margins-.

          Comment


          • #6
            Thank you for your help.

            Comment


            • #7
              Hello Clyde, I am a new member of statalist.

              I have more or less same kind of problem. I would like to consul about my problem..
              I am working on a paper about the Environmental Kuznets Curve. I have already include i.year in my fixed-effects model to capture the effect of technological change.

              I want to check the slope homogeneity assumption in my panel data. Can I do it by adding country specific trend (c.year##i.country) into the equation?
              is there another way to check the slope homogeneity assumption?

              Your help is really appreciated.
              Thank you.

              Comment


              • #8
                Yes, you can do that. I wouldn't go so far as to say there is no other way to do it, but this is the simplest. Since it sounds like you are using -xtreg, fe-, you will not be able to use the other commonly used approach: -suest-. The use of an interaction term is the most straightforward way to test effect heterogeneity. Its only real drawback, that is assumes that the other effects are homogeneous can, in most instances, be overcome by adding more interaction terms for those. (And if you're in a situation where that approach fails because you are exhausting your degrees of freedom, you probably don't really have enough degrees of freedom to test heterogeneity of effect to start with.)

                Comment


                • #9
                  Thank you for you quick response.

                  If I may further ask, I am using -xtreg, fe- , xtivreg, fe- and -xtivreg2, fe- commands for endogeneity checking.

                  For xtreg, I compare three results, which are:
                  fixed-effects country ----> xtreg depvar predictor1 predictor2, fe cluster(id)
                  fixed effects country and years -----> xtreg depvar predictor1 predictor2 i.year, fe cluster(id)
                  country specific trend ------> xtreg depvar predictor1 predictor2 i.year c.year##i.country, fe cluster(id)

                  If most siginificance relationshipe go away at the third estimation, does it mean the slope is heterogeneous?
                  Are these the correct way to do it?

                  However, it wont work for the IV estimation.
                  I am sorry for asking too many things, I am new to Stata, and still confuse.

                  Thank you for your time in advance.
                  Last edited by Eugenia Erningdianhastuti; 26 Aug 2016, 09:55.

                  Comment


                  • #10
                    Eugenia:
                    unfortunately, you do not show us what Stata gave you back (please read the FAQ on how to use CODE delmiters for that purpose).
                    As far as endogeneity is concerned, set aside some self-apparent examples (e.g. regressing gross wage on education leaving indidual ability within the residuals), literature in your research field should give you same guidance.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      Dear Carlo,
                      Thank you for your reply.

                      I am still trying to understand how to put Stata's result on a post.

                      But meanwhile, if you don't mind, I want to clarify some things.
                      For the equation: xtreg depvar predictor1 predictor2 i.year c.year##i.country, fe cluster(id) --- by running this estimation, do I already have account for heterogeneity across country-year to account for heterogeneous slope?


                      And, when I run for IV estimation:
                      xtivreg depvar predictor1 predictor2 i.year c.year##i.id (y = age fert), fe vce(robust) small

                      Stata will response in error saying:
                      --- independent variables are collinear with the panel variable id ---
                      Is it because the -fe- options? Because when I try the estimation without mentioning -fe-, it works.

                      Is it correct not to write the -fe- option for the last estimation I mentioned?

                      I am sorry if I have not make myself clear enough, I am trying to understand how econometrics and Stata work. Thank you so much for your help.

                      Best regards,
                      Eugenia

                      Comment


                      • #12
                        Eugenia:
                        it seems to me that Clyde reply #5 covers your first question.
                        As far as your second query is concerned, Stata warns you about collinearity with the panel variable under -fe- specification (that gets rid of time-invariant preditors).
                        If you do not mention -fe- you're actually invoking -re- (random effect) specification, which is a quite different tool.
                        In fact, Stata -xt- command use -re- as the default specification; hence, if you don't explicit type -fe-, Stata goes -re- automatically.
                        Kind regards,
                        Carlo
                        (Stata 19.0)

                        Comment


                        • #13
                          Yes, sorry. Clyde has already confirmed my first question.

                          Thank you for your answer, I realise now that by excluding -fe- options is a wrong way in estimating my model. Although, I still don't understand how the collinearity exist while the same factorial interaction variable works for -xtreg-.
                          Do you know, if in any case, why it can happen?

                          Thank you for your time.

                          Best regards,
                          Eugenia

                          Comment


                          • #14
                            Eugenia:
                            I would say that the apparently weird behaviour that you reported is due to the differences in -fe- and -re- machinery, as you can see from the following toy-example:
                            Code:
                            . use http://www.stata-press.com/data/r14/nlswork.dta
                            (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
                            
                            . xtreg ln_wage age race i.year, fe
                            note: race omitted because of collinearity
                            
                            Fixed-effects (within) regression               Number of obs     =     28,510
                            Group variable: idcode                          Number of groups  =      4,710
                            
                            R-sq:                                           Obs per group:
                                 within  = 0.1060                                         min =          1
                                 between = 0.0914                                         avg =        6.1
                                 overall = 0.0805                                         max =         15
                            
                                                                            F(15,23785)       =     188.00
                            corr(u_i, Xb)  = 0.0467                         Prob > F          =     0.0000
                            
                            ------------------------------------------------------------------------------
                                 ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                            -------------+----------------------------------------------------------------
                                     age |   .0125992   .0102163     1.23   0.217    -.0074253    .0326238
                                    race |          0  (omitted)
                                         |
                                    year |
                                     69  |   .0748621   .0159011     4.71   0.000      .043695    .1060292
                                     70  |   .0478697   .0235673     2.03   0.042     .0016763     .094063
                                     71  |   .0865577   .0327939     2.64   0.008     .0222795     .150836
                                     72  |   .0856757   .0424903     2.02   0.044     .0023919    .1689594
                                     73  |   .0880069    .052344     1.68   0.093    -.0145906    .1906044
                                     75  |   .0778607   .0720304     1.08   0.280    -.0633235    .2190449
                                     77  |    .108365   .0922272     1.17   0.240    -.0724063    .2891363
                                     78  |   .1309518   .1028143     1.27   0.203    -.0705707    .3324743
                                     80  |   .1142649    .122792     0.93   0.352    -.1264152     .354945
                                     82  |   .1090451   .1431112     0.76   0.446    -.1714619    .3895522
                                     83  |   .1211272   .1532018     0.79   0.429    -.1791581    .4214125
                                     85  |   .1465637   .1736146     0.84   0.399    -.1937321    .4868594
                                     87  |   .1382642   .1941163     0.71   0.476     -.242216    .5187445
                                     88  |   .1799741   .2079871     0.87   0.387    -.2276938     .587642
                                         |
                                   _cons |   1.203731   .1952306     6.17   0.000     .8210667    1.586396
                            -------------+----------------------------------------------------------------
                                 sigma_u |   .4058746
                                 sigma_e |  .30300411
                                     rho |  .64212421   (fraction of variance due to u_i)
                            ------------------------------------------------------------------------------
                            F test that all u_i=0: F(4709, 23785) = 8.80                 Prob > F = 0.0000
                            
                            . xtreg ln_wage age race i.year, re
                            
                            Random-effects GLS regression                   Number of obs     =     28,510
                            Group variable: idcode                          Number of groups  =      4,710
                            
                            R-sq:                                           Obs per group:
                                 within  = 0.1060                                         min =          1
                                 between = 0.1013                                         avg =        6.1
                                 overall = 0.0936                                         max =         15
                            
                                                                            Wald chi2(16)     =    3322.24
                            corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                            
                            ------------------------------------------------------------------------------
                                 ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                            -------------+----------------------------------------------------------------
                                     age |   .0129627   .0018813     6.89   0.000     .0092755      .01665
                                    race |   -.094396   .0119103    -7.93   0.000    -.1177398   -.0710522
                                         |
                                    year |
                                     69  |    .075438   .0125016     6.03   0.000     .0509353    .0999407
                                     70  |   .0471032   .0120412     3.91   0.000     .0235028    .0707035
                                     71  |   .0844863   .0125233     6.75   0.000      .059941    .1090315
                                     72  |   .0858609   .0135859     6.32   0.000     .0592329    .1124888
                                     73  |   .0879972   .0143298     6.14   0.000     .0599113     .116083
                                     75  |   .0763768   .0167026     4.57   0.000     .0436404    .1091133
                                     77  |   .1105803   .0196514     5.63   0.000     .0720643    .1490963
                                     78  |   .1359224   .0214146     6.35   0.000     .0939505    .1778942
                                     80  |    .118443   .0247018     4.79   0.000     .0700284    .1668576
                                     82  |   .1097735   .0279717     3.92   0.000     .0549501     .164597
                                     83  |   .1245107   .0297346     4.19   0.000     .0662319    .1827894
                                     85  |   .1510308   .0332019     4.55   0.000     .0859564    .2161052
                                     87  |   .1408315   .0367642     3.83   0.000     .0687751     .212888
                                     88  |   .1794208   .0391863     4.58   0.000      .102617    .2562246
                                         |
                                   _cons |   1.299731   .0414305    31.37   0.000     1.218529    1.380933
                            -------------+----------------------------------------------------------------
                                 sigma_u |  .36412525
                                 sigma_e |  .30300411
                                     rho |  .59085549   (fraction of variance due to u_i)
                            ------------------------------------------------------------------------------
                            Kind regards,
                            Carlo
                            (Stata 19.0)

                            Comment


                            • #15
                              Carlo,
                              Yes, I think it's because of the panel id effects..but I am not sure yet how to make the country specific time trend works in -xtivreg- command.
                              I think I am gonna re-evaluate the model.

                              Thank you so much for your help..

                              Best regards,
                              Eugenia

                              Comment

                              Working...
                              X