Here is the do file, but still i did not succeed
version 8.0
clear
set mem 10m
use "C:\Documents and Settings\User\Desktop\panel_a.dta", clear
set matsize 800
tsset country year, yearly
*CHECKING DATA;
describe
summarize
*SET INDIVIDUAL (i) AND TIME (t) INDEXES;
iis country
tis year
sort country year
sort country year
by country: gen lsrt_1=lsrt[_n-1]
by country:gen lsrt_2=lsrt[_n-2]
gen dlsrt=lsrt-lsrt_1
gen dlsrtl=lsrt_1-lsrt_2
list country year lsrt lsrt_1 lsrt_2 dlsrt
*SET INDIVIDUAL (i) AND TIME (t) INDEXES;
.
. iis country
. tis year
. sort country year
.
. sort country year
. by country: gen lsrt_1=lsrt[_n-1]
(21 missing values generated)
. by country:gen lsrt_2=lsrt[_n-2]
(42 missing values generated)
. gen dlsrt=lsrt-lsrt_1
(21 missing values generated)
. gen dlsrtl=lsrt_1-lsrt_2
(42 missing values generated)
.
. list country year lsrt lsrt_1 lsrt_2 dlsrt
+-------------------------------------------------------------+
| country year lsrt lsrt_1 lsrt_2 dlsrt |
|-------------------------------------------------------------|
1. | 1 1967 2.712653 . . . |
2. | 1 1968 2.54155 2.712653 . -.171103 |
3. | 1 1969 2.505365 2.54155 2.712653 -.036185 |
4. | 1 1976 2.378957 2.505365 2.54155 -.1264076 |
5. | 1 1978 2.414159 2.378957 2.505365 .0352013 |
|-------------------------------------------------------------|
6. | 1 1979 2.452249 2.414159 2.378957 .0380907 |
7. | 1 1981 2.415434 2.452249 2.414159 -.0368152 |
8. | 1 1982 2.454014 2.415434 2.452249 .0385797 |
9. | 1 1985 2.468911 2.454014 2.415434 .0148969 |
10. | 1 1986 2.546347 2.468911 2.454014 .0774364 |
|-------------------------------------------------------------|
11. | 1 1989 2.508549 2.546347 2.468911 -.0377982 |
12. | 1 1990 2.557495 2.508549 2.546347 .0489459 |
13. | 1 1994 2.549296 2.557495 2.508549 -.008199 |
14. | 1 1996 2.583857 2.549296 2.557495 .0345614 |
15. | 2 1970 3.186564 . . . |
|-------------------------------------------------------------|
16. | 2 1972 3.151164 3.186564 . -.0354004 |
17. | 2 1973 3.094853 3.151164 3.186564 -.0563102 |
18. | 2 1974 3.164042 3.094853 3.151164 .0691881 |
19. | 2 1975 3.182587 3.164042 3.094853 .0185454 |
20. | 2 1976 3.121514 3.182587 3.164042 -.0610731 |
|-------------------------------------------------------------|
21. | 2 1977 3.190412 3.121514 3.182587 .0688984 |
22. | 2 1978 3.210852 3.190412 3.121514 .0204399 |
23. | 2 1979 3.2226 3.210852 3.190412 .0117481 |
24. | 2 1980 3.248157 3.2226 3.210852 .0255563 |
25. | 2 1981 3.29013 3.248157 3.2226 .0419731 |
|-------------------------------------------------------------|
26. | 2 1982 3.307734 3.29013 3.248157 .0176039 |
27. | 2 1983 3.294813 3.307734 3.29013 -.0129201 |
28. | 2 1984 3.287895 3.294813 3.307734 -.0069182 |
29. | 2 1985 3.317431 3.287895 3.294813 .0295362 |
30. | 2 1986 3.338941 3.317431 3.287895 .0215092 |
|-------------------------------------------------------------|
31. | 2 1987 3.304351 3.338941 3.317431 -.03459 |
32. | 2 1988 3.190645 3.304351 3.338941 -.1137056 |
33. | 2 1989 3.210089 3.190645 3.304351 .0194445 |
34. | 2 1990 3.163065 3.210089 3.190645 -.047024 |
35. | 2 1991 3.119796 3.163065 3.210089 -.0432699 |
|-------------------------------------------------------------|
36. | 3 1969 2.724623 . . . |
37. | 3 1973 2.700287 2.724623 . -.0243354 |
38. | 3 1975 2.785161 2.700287 2.724623 .0848737 |
39. | 3 1976 2.811372 2.785161 2.700287 .0262105 |
40. | 3 1977 2.947806 2.811372 2.785161 .1364348 |
|-------------------------------------------------------------|
41. | 3 1979 3.066484 2.947806 2.811372 .1186774 |
42. | 3 1985 3.140994 3.066484 2.947806 .0745101 |
43. | 3 1988 3.000554 3.140994 3.066484 -.1404402 |
44. | 3 1992 2.924923 3.000554 3.140994 -.0756302 |
--more--
ivreg dlsrt (dlsrtl=lsrt_2)
tsset country year
xtivreg lsrt (lsrt_1=lsrt_2), fd
Instrumental variables (2SLS) regression
Source | SS df MS Number of obs =
354
-------------+------------------------------ F( 1, 352) =
8.73
Model | -2.29010053 1 -2.29010053 Prob > F =
0.0033
Residual | 4.26690113 352 .012121878 R-squared =
.
-------------+------------------------------ Adj R-squared =
.
Total | 1.9768006 353 .005600002 Root MSE =
.1101
------------------------------------------------------------------------------
dlsrt | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+----------------------------------------------------------------
dlsrtl | 1.013682 .3430418 2.95 0.003 .3390123
1.688351
_cons | -.001148 .0064632 -0.18 0.859 -.0138594
.0115635
------------------------------------------------------------------------------
Instrumented: dlsrtl
Instruments: lsrt_2
------------------------------------------------------------------------------
. tsset country year
panel variable: country, 1 to 21
time variable: year, 1950 to 1998, but with gaps
. xtivreg lsrt (lsrt_1=lsrt_2), fd
First-differenced IV regression Number of obs =
272
Group variable: country Number of groups =
21
R-sq: within = 0.6984 Obs per group: min =
1
between = 0.9997 avg =
15.9
overall = 0.9787 max =
45
chi2(1) =
0.06
corr(u_i, Xb) = -0.9785 Prob > chi2 =
0.8009
------------------------------------------------------------------------------
d.lsrt | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+----------------------------------------------------------------
lsrt_1 |
D1 | -.1323335 .5247273 -0.25 0.801 -1.16078
.8961132
_cons | -.0002588 .0041095 -0.06 0.950 -.0083133
.0077957
-------------+----------------------------------------------------------------
sigma_u | .40358129
sigma_e | .05979004
rho | .97852333 (fraction of variance due to u_i)
------------------------------------------------------------------------------
Instrumented: lsrt_1
Instruments: lsrt_2
your proposal
tsset country year
panel variable: country, 1 to 21
time variable: year, 1950 to 1998, but with gaps
. gen lsrt_l=l.lsrt
(107 missing values generated)
. gen lsrt_ll=l2.lsrt
(109 missing values generated)
.
. list country year lsrt_l lsrt_ll
+--------------------------------------+
| country year lsrt_l lsrt_ll |
|--------------------------------------|
1. | 1 1967 . . |
2. | 1 1968 2.712653 . |
3. | 1 1969 2.54155 2.712653 |
4. | 1 1976 . . |
5. | 1 1978 . 2.378957 |
|--------------------------------------|
6. | 1 1979 2.414159 . |
7. | 1 1981 . 2.452249 |
8. | 1 1982 2.415434 . |
9. | 1 1985 . . |
10. | 1 1986 2.468911 . |
|--------------------------------------|
11. | 1 1989 . . |
12. | 1 1990 2.508549 . |
13. | 1 1994 . . |
14. | 1 1996 . 2.549296 |
15. | 2 1970 . . |
|--------------------------------------|
16. | 2 1972 . 3.186564 |
17. | 2 1973 3.151164 . |
18. | 2 1974 3.094853 3.151164 |
19. | 2 1975 3.164042 3.094853 |
20. | 2 1976 3.182587 3.164042 |
|--------------------------------------|
--more--
>>> [email protected] 04/30/04 6:00 PM >>>
Antonio,
Date sent: Fri, 30 Apr 2004 13:04:56 +0200
From: "Antonio Rodrigues Andres" <[email protected]>
To: <[email protected]>
Subject: st: xtivreg, fd
Send reply to: [email protected]
> Dear Stata users
> I am trying a simple dynamic model with the lagged value of the dep.
> variable as regressor. I pretend to obtain the Anderson-Hsiao
estimator
> using yit-2 as instrument but i did not succeed. I should get the same
> results using xtivreg, fd and ivreg with the differenced variables
>
> Does anybody knows why not
>
> sort country year
> by country: gen lsrt_1=lsrt[_n-1]
> by country:gen lsrt_2=lsrt[_n-2]
Does Stata know at this point that your data are panel data? If not,
some of the lags might be messed up. For example, the 1-period lag
for the first time period of observation 2 should be missing, but
Stata might be using the latest time period of observation 1 instead.
If you use tsset and then time series operators to create the lags,
e.g., l2.lsrt instead of lsrt[_n-2], this won't happen and the lags
will be correct.
Hope this helps.
--Mark
> gen dlsrt=lsrt-lsrt_1
> gen dlsrtl=lsrt_1-lsrt_2
>
> Model yt= alpha* yt-1 + eta _i +ut
> variables have been already differenced
>
> ivreg dlsrt (dlsrtl=lsrt_2) using yit-2 as instrument
>
> tsset country year
> xtivreg lsrt (lsrt_1=lsrt_2), i(country) fd
>
> Regards
> Antonio
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
Prof. Mark E. Schaffer
Director
Centre for Economic Reform and Transformation
Department of Economics
School of Management & Languages
Heriot-Watt University, Edinburgh EH14 4AS UK
44-131-451-3494 direct
44-131-451-3008 fax
44-131-451-3485 CERT administrator
http://www.som.hw.ac.uk/cert
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/