Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: levinlin and ipshin within a loop


From   "Dev Vencappa" <[email protected]>
To   <[email protected]>
Subject   Re: st: levinlin and ipshin within a loop
Date   Wed, 22 Oct 2003 13:59:52 +0100

Stata users, I have a slight problem with panel unit root test. 
 Thanks to an earlier suggestion by Nick, Ernest and others, I managed to replicate what I am doing below for simple time series. 
  My current problem is that I have four variables recorded in a panel of 19 companies over 18 years. For each variable,I have worked out an optimal lag length for each company, and would now like levinlin to be able to read this optimal lag length for each company rather than me having to feed it in the lags option of the command every time.  I have come up with the following loop, which does not seem to work unfortunately. Can anybody spot the problem please and suggest a shortcut to that if possible? The same thing will also be used for ipshin. Does anybody also know how to save the results of ipshin and call them into a variable?
 
foreach k of varlist netprem disclm elr solv {
preserve
keep if variable=="`k'"
forvalues x=1/19{
sum lagrawnotrend if comcode==`x', mean
scalar A`x'=r(mean)
}

levinlin `k', lags(`A1' `A2' `A3' `A4' `A5' `A6' `A7' `A8' `A9' `A10' `A11' `A12' `A13' `A14' `A15' `A16' `A17' `A18' `A19')
restore 
}

Many thanks

Dev



Dev Vencappa
School of Economics
University of Nottingham
University Park
Nottingham
NG7 2RD
U.K.
Tel : +44 (0)115 951 5608
Fax: +44 (0) 115 951 4159

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index