Dear Scott and Sean,
Thank you very much for posting this codes. THis is what i need!
I just have a few questions 'coz it returns an error to my data.
i'm a beginner in dynamic panel analysis. i need the optimal lag to
use levinlin and pescadf
my data is i=77 and T=7 (panel survey of every three years)
I was trying to adapt the codes below. Why does it only use 12
countries in the panel?
I tried removing this line to include my 77 i (province), but i got an
error "insufficient observation."
Is 13 in the "keep if country < 13" an arbitrary chosen number because
countries in the example is more than this.
Please tell me what this means:
forv i = 1(5)60 {
local lag = opt[`i']
local opt_lag "`opt_lag' `" "' `lag'"
What is the 1(5)60.
I hope somebody can explain. I really need this codes figure out badly.
Thank you so much!!!
Majah
use http://fmwww.bc.edu/ec-p/data/hayashi/sheston91.dta,clear
qui {
keep if country < 13
preserve
levels country, local(levels)
foreach l of local levels {
varsoc rgdp if country == `l'
matrix A = r(stats)
if `l' > 1 {
matrix C = C \ A
}
else {
matrix C = A
}
}
svmat C, name(col)
keep if HQ < .
egen id = fill(1 1 1 1 1 2 2 2 2 2)
egen minh = min(H), by(id)
gen optimal_lag = lag if minh == HQ
sort id opt
forv i = 1(5)60 {
local lag = opt[`i']
local opt_lag "`opt_lag' `" "' `lag'"
}
restore
}
levinlin rgdp, lag(`opt_lag')
*
* 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/