Announcement

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

  • lagged differenced variable

    Dear Members,

    Could someone help me to define what is meant by lagged difference variable? I need to include one period lagged variable written in first differenced form?

    Does the command look like this?

    gen d_lnx= lnx[_n]-lnx[_n-1]
    gen l1_dlnx= dlnx[_n-1]


    Many thanks,



    kind regards,

  • #2
    I am also not sure what a "lagged difference variable" is, but I would guess the same as you. To implement the calculations, however, I would use Stata's lag operators, once your data have been tsset or xtset. (I am assuming your data are in long format.) This approach takes proper account of gaps in your data. That is, mimicking your code outline ...

    Code:
    xtset panelvar timevar // substitute the appropriate names from your dataset
    ge d_lnx = lnx  - L.lnx
    ge l1_dlnx = L.d_lnx

    With no gaps (missing data) in your panel dataset, won't the lagged difference be equal to L.lnx - L2.lnx? With gaps, it might not be. (I have not checked this) If my conjecture is correct, then you can calculate your variable in one step.

    Comment


    • #3
      Dear Stephen,
      Thanks for your help


      I actually have confusion about the variable which is used in the paper. referring to it I wrote the term as lagged difference variable. I attached the file describing the format of the variable
      Attached Files

      Comment


      • #4
        That is to be interpreted as the previous period's percentage change in GDP. It is an approximation only. Almost any Math for Economics book will serve as a reference.
        You should:

        1. Read the FAQ carefully.

        2. "Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!"

        3. Describe your dataset. Use list to list data when you are doing so. Use input to type in your own dataset fragment that others can experiment with.

        4. Use the advanced editing options to appropriately format quotes, data, code and Stata output. The advanced options can be toggled on/off using the A button in the top right corner of the text editor.

        Comment


        • #5
          Stephen: It is even simpler, by combining the lag and difference operators in one step:
          Code:
          gen l1_dlnx = LD.lnx
          If lnx is missing in the current or one of the two previous periods, this would evaluate to missing.
          https://www.kripfganz.de/stata/

          Comment


          • #6
            I now got the meaning. So, if I need to create growth rate of GDP with one period lagged values the command will be like this: gen d_lnGDP= lnGDP[_n]-lnGDP[_n-1]
            gen l1_dlnGDP= l.d_lnGDP[_n-1]

            If I don't have any gaps, then I can use the command suggested by Stephen. Am I right?


            Thanks for all efforts


            Comment


            • #7
              I would follow Sebastian's advice. (Sebastian: thanks for telling us about the 'combination' trick! I didn't know it.)
              Nigar: I think you should use the built-in lag (and difference) operators, as they will handle data issues such as gaps in an appropriate way. Hand-calculating as you suggest can duplicate Stata's behaviour but it's harder to cover all eventualities.

              Comment


              • #8
                Hello Stephen,
                Please let me know how to interpret the lagged difference variable?
                I have a longitudinal data for mother's anxiety and depression scores.

                Comment


                • #9
                  Hi Sebastian

                  I would like to know if this same principle regarding combining the lag and difference operators is applicable in the case of the xtpmg command with Panel ARDL. I have already determined the optimal lag length of the model for the variables to be (1 0 0 1) respectively using the command .below which was developed by Anat Tchetchik and I have included my variables


                  forval i = 1/10{
                  ardl TFDI GDPPC OPEN IR if (COUNTRY==`i'), maxlag (1 1 1 1)
                  matrix list e(lags)
                  di
                  }


                  I am using Panel ARDL command xtpmg d.tfdi d.gdppc d.open d.IR, lr(l.TFDI GDPPC OPEN IR EPA) ec(ECT replace pmg


                  EPA iis a dummy variable



                  I need to include the lags of the dependent variable TFDI and IR in the short run aspect of the model. So if I use your suggested code I would just type LD.TFDI and LD.IR in the syntax after having generated such a variable in my dataset. Am I right?


                  Also I am gathering if a variable has more than one lag I just would have to replace l1 with l2 as i have done in your code below.
                  gen l2_dlnx = LD.lnx

                  Any response is greatly appreciated

                  Thanks

                  Alistair
                  Last edited by Alistair Alleyne; 20 Mar 2019, 06:17.

                  Comment


                  • #10
                    Please see the following help file:
                    Code:
                    help tsvarlist
                    I cannot specifically comment on the xtpmg command as I have never used it.
                    https://www.kripfganz.de/stata/

                    Comment


                    • #11
                      Thanks for your reply Sebastian

                      Comment

                      Working...
                      X