Announcement

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

  • lag regression by one year

    hi
    i am doing panel data fixed effect regression(xtreg) and using data set about 56 countries and time period 2000-2014 with year missing 2001 because data is not available.i want to regress data with lag regression by one year(required by my supervisor). i am using dummies variables in my regression.

    i have no idea how to perform lag regression and what is the reasion behind this.


    regards
    rafay

  • #2
    xtset country year

    and then put an L. before each variable you want to lag such as L.GDP

    Comment


    • #3
      Philip Gigliotti has given you some advice on how to do it.

      As for the reason behind it, you actually need to ask your supervisor, as this is a scientific, not a statistical issue and you have said nothing about the nature of the research question or the nature of the data. Just generally, it is often the case when longitudinal data is available, that one expects the effects of one variable on another to appear with a delay. That is, this year's value of Y may depend on last year's value of X rather than on the current value. Indeed, it can be more general: sometimes one expects Y to depend on a value of X from several years back, or even jointly on more than one past year. Just when those situations arise depends on the subject matter and the science. So your supervisor, or a colleague who is familiar with what you are working on, is the best person to ask for the reason.

      Note that if it turns out that you need to include lags other than just single year, Stata offers those as well: e.g. L5.GDP is the GDP from 5 years (or whatever the time unit in your data is) ago. See -help tsvarlist- and the linked manual section in [U] for a full exposition.
      Last edited by Clyde Schechter; 22 Dec 2016, 15:56. Reason: Correct typos.

      Comment


      • #4
        thanks Clyde Schechter and Philip Gigliotti

        Clyde Schechter you explained exactly in the same way thanks a lot.

        Further i am using year dummies (global yeardummy year2003 year2004 year2005 year2006 year2007 year2008 year2009 year2010 year2011 year2012 year2013 year2014
        ) i have data now from 2002-2014, for lagging regression i have to put just L. before $yeardummy??? .i am bit confused as i am new to stata usage.


        cc Philip Gigliotti

        Comment


        • #5
          First, you should not use a global macro for this. You should be using a local macro. Global macros are inherently dangerous because their names may clash with global macros defined in other programs that are running (and that you may not be aware of). The bugs that can result from this are maddeningly difficult to find and trace because they come and go depending on what else is happening outside your program. Global macros should only be used when there is no alternative that will work.

          Next, you should not create separate variables for each year like this. You should have a single variable, year. Then you just include i.year in your regression variable list and Stata automatically creates virtual indicator variables for all but one of them. (If you want to control which one, you can do so--see -help fvvarlist- for details.) But you don't want to lag the year variable anyway: that would make no sense. What you want to do is lag the other variables (which other variables, I don't know.) But your code would look something like this:
          Code:
          xtreg outcome_var L.gdp i.year, fe
          to incorporate year fixed effects and lag GDP as a predictor by one year.

          Comment


          • #6
            clyde schecter thanks a lot

            my research question is to check the effect of political stability on number of tourists arrival
            by lagging by one year mean here is to check the chances in which tourists had changed their decision from one country to another country due to worse situation there.could you please have a look one my both below regression.either i am on right way or not

            without lag
            xtreg D Ruleoflaw Governmenteffectiveness Controlofcorruption Regulatoryquality Voiceandaccountability Politicalstability Civilvoilevncewar PTSS i.year DollarExchangerateLN H, fe
            with lag
            xtreg D L.Ruleoflaw L.Governmenteffectiveness L.Controlofcorruption L.Regulatoryquality L.Voiceandaccountability L.Politicalstability L.Civilvoilevncewar L.PTSS L.i.year L.H, fe

            Comment


            • #7
              From the perspective of Stata syntax both models look correct. There are a couple of substantive issues with the "with lag" version:

              1. I wouldn't use L.i.year. It's perfectly legal, and it probably won't hurt any of the other estimates, but it doesn't make sense to me. The purpose of including year indicators is to adjust for year-to-year shocks in the outcome variable. But those shocks are the same whether you call this year 2016 or call it 2015. By using the lag operator here, all you are doing is renaming the years--and with the insidious side effect of causing the earliest year in the data to drop out because there is no lagged value for it! So just use i.year for the year effects, even in the lagged model.

              2. The variable DollarExchangerateLN which appears in the without-lag model is not included in your lagged model. While this is a scientific rather than a statistical question, just from a lay person's perspective, I can't think of any reason to omit this variable from the lagged model. Of course, my travel plans being made today will depend on today's exchange rate, not last years. So I would include it without lag, but I would not leave it out.

              One more thought applicable to both models. I'm venturing out of my expertise here, relying more on my general sense of things and some experience as an international traveler. If what I say below contradicts what people with expertise in the study of international travel tell you, disregard this particular bit of advice.

              3. The dollar exchange rate fluctuates at least daily, if not by the minute. I suppose your variable is some aggregate measure or yearly average or something like that. When exchange rates are reasonably stable, I suppose that's good enough for this purpose. But if you have sudden currency shocks within a year (i.e. the Brexit vote), this representation may fail to capture a very important effect. I would imagine that international tourism is rather sensitive to exchange rate fluctuations--it certainly has a large impact on my decisions about that!

              Comment


              • #8
                thanks Clyde Schehter

                Comment


                • #9
                  Originally posted by Philip Gigliotti View Post
                  xtset country year

                  and then put an L. before each variable you want to lag such as L.GDP
                  When I am using L, stata gives error "no observation"

                  Comment

                  Working...
                  X