Announcement

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

  • Help: a fixed effect first order autoregressive model

    Dear all,
    I am replicating a paper, and need use panel data(firm, year) to estimate a fixed-effect first-order autoregressive model as follows:
    Yit = ai + bt + c*Yit-1 + d*Mit-1+eit

    Then, I need use the time-series residuals for every firm and every firm-year residuals from the model estimation for future calculations.
    My questions are: 1) what steps and which stata code can be used to estimate the fixed-effect first-order autogressive model?
    I am thinking use " xtest gvkey year; xtreg Y l1.Y l1.M, fe" ?

    2) how can I get the time-series residuals for every firm and every firm-year residuals after the model estimation?

    Your guidance and assistance is greatly appreciated!
    Best,
    Jessica


    BTW: my data looks like
    gvkey year Y M
    1 2000 16 14
    1 2001 17 15
    1 2002 18 16
    1 2003 22 20
    1 2004 20 18
    1 2005 10 16
    1 2006 22 20
    2 2000 16 14
    2 2001 17 15
    2 2002 18 16
    2 2003 22 20
    2 2004 20 18
    2 2005 10 16
    2 2006 22 20
    Last edited by Jessica Xie; 19 Mar 2016, 20:01.

  • #2
    I assume "xtest" is a typo for "xtset." Following that -xtreg Y l1.Y l1.M, fe- is not quite what you want, because it does not contain a term corresponding to bt in your equation. Also, while it implicitly captures the ai, it does so implicitly and does not give any estimates for those terms. Often they are not considered of interest.

    So I think you need -xtreg Y i.year l1.Y l1.M, fe- so that you incorporate the time effects. ( If you also want the ai terms explicitly, then it would be -regress Y i.gvkey i.year l1.Y l1.M-. That will give you the same results as the -xtreg- version as far as all other coefficients are concerned, the only difference will be the explicit appearance of firm effects.)

    Finally, after estimation with -xtreg-, you can get residuals with -predict firm_level, u- and firim-year level residuals with -predict observation_level, ue-.

    Comment


    • #3
      Thank you for your prompt assistance, Clyde!
      Thank you for your suggestions. I understand it now.

      But an issue is that when I tried to get ai terms by using code "-regress Y i.gvkey i.year l1.Y l1.M-", the stata shows error since there are too many dummy variables for gvkey (representing firm). I have more than 5000+ firms in each year in the sample. Please advice. Thanks!

      Best!
      Last edited by Jessica Xie; 20 Mar 2016, 02:54.

      Comment


      • #4
        So use -xtreg Y i.year l1.Y l1.M, fe-. Then -predict firm_level_effect, u- will give you the firm-level intercepts.

        Comment

        Working...
        X