Announcement

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

  • Multilevel analysis: Dynamic models & lagged variables.

    Hi everyone,

    After a couple of months I finally gathered the data of my 5 weekly diary study on the work and life of expatriates in South-Korea. Currently I am busy with the analysis of the data. I assume that my dependent variables (stress& engagement) do not have a linear trend over 5 weeks but can fluctuate. Therefore I turend to dynamic modles instead of the linear growth model.

    These dynamic models require lagged variables and I have been trying figuring out how to calculate these.

    On the Stata website, I came across the following command:


    . gen lag1 = x[_n-1] . gen lag2 = x[_n-2] . gen lead1 = x[_n+1]

    I have been using these formulas to create 1 lead and 5 lag variables (since there are 5 weekly diaries). However, I have a couple of questions regarding this analysis, since I am currently very unfamiliar with this kind of multilevel modelling.

    1. When calculating the lagged variables, I get missing values. I found this rather odd, since all participants have filled in the 5 weekly diaries, hence they have 5 data points for each dependent variable. Does anyone know whether I am missing something?


    2. When conducting multilevel analysis for every seperate dependent variable, I used

    . xtreg lead1 lag1 lag2 lag3 lag4 lag5, re mle
    However, for some of the dependent variables the first lag was not significant. Is this a problem?




    I am sorry if it is a bit unclear. The study is for my undergraduate thesis project, so it is my first time using STATA and multilevel modeling.

  • #2
    First, it is generally good to set the time and panel variable (tsset or xtset) in Stata. Then you can use lags (L.) and leads (F.) with no problem at all.
    With the data time and individual set, Stata won't lag across individuals and will recognize missing days. _n-1 just takes the previous observation whether that is one time period before or many, and will lag across individuals.

    If you're getting odd missing data, either list the data out or look at the data in the data viewer to see what is going wrong.

    Once you've xtset your data, Stata will allow L. and F. etc. variables in most of its estimation procedures. Another benefit of using these instead of _n-1 is that they work more neatly with the margins command (which we use a lot post estimation).

    We normally call xtreg a panel estimator - it is similar to a multilevel analysis but the mixed procedure is often discussed for multilevel. xtreg is a sub-division of what mixed will estimate.

    If you have a lagged dv on the rhs, you generally will not get consistent estimates with xtreg. You should look at xtivreg and xtivreg2. There are fancier estimators, but these are pushing your skill level.

    That a first lag is not significant is just a fact of the analysis. However, why you need five lags is not clear. You will also need to use a hausman test to see if you can use random vs fixed effects.

    Phil


    Comment


    • #3
      @Phill, thank you for your response.

      However, there is still one problem that I face regarding the missing data. I have used xtset. to set the time and panel variables.
      After that, I tried creating a lag variable, but there is still 1 missing variable. I have listed the dependent variable and its lagged variable. Below you can see the results of the first two participants:

      TotGLS~k
      ----------
      1. 2.8
      2. 2.7
      3. 3.2
      4. 2.9
      5. 2.6
      ----------
      6. 2.8
      7. 2.7
      8. 3
      9. 2.6
      10. 2.8
      +--------+
      gllag1
      --------
      1. .
      2. 2.8
      3. 2.7
      4. 3.2
      5. 2.9
      --------
      6. 2.6
      7. 2.8
      8. 2.7
      9. 3
      10. 2.6

      I still do not understand why the first participant has a missing variable. Does anyone know whether there is a solution to this problem?

      Comment

      Working...
      X