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
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 |
Comment