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

Re: st: RE: RE: feeding optimal lag lengths in levinlin andipshinwithin a loop


From   "Dev Vencappa" <[email protected]>
To   <[email protected]>
Subject   Re: st: RE: RE: feeding optimal lag lengths in levinlin andipshinwithin a loop
Date   Wed, 22 Oct 2003 14:46:42 +0100

Nick
forgot to mention. The results of summarize are all integers indeed.

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
>>> [email protected] 10/22/03 2:26 PM >>>
You don't say how this fails to work, but a lot may
hinge on 

keep if variable == "`k'" 

which suggests either an unusual data structure 
or a misunderstanding of -keep-. 

However, none of the -preserve-, -restore- or 
-keep- seems essential for the rest of the code. 

Also, are the results of -summarize- all integers? 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of 
> Dev Vencappa
> Sent: 22 October 2003 14:15
> To: [email protected]
> Subject: st: RE: feeding optimal lag lengths in levinlin and
> ipshinwithin a loop
> 
> 
> 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 
> }
> 

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



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