-levelsof- with -foreach- can be used to cycle through the groups and test
for a unit-root in each one. You could also use -post- to collect the
results. For example:
webuse grunfeld,clear
tempfile results
tempname hold
postfile `hold' company pvalue test_stat using `results'
levelsof company, local(levels)
foreach l of local levels {
qui dfuller invest if com == `l'
post `hold' (`l') (r(p)) (r(Zt))
}
postclose `hold'
preserve
use `results', clear
l
restore
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Jason Yackee
> Sent: Thursday, September 14, 2006 6:45 PM
> To: [email protected]
> Subject: st: test for stationarity that accepts the "by" command?
>
> Dear Stata seers,
>
> I am trying to test for stationarity of cross-sectional time series data
> for individual cross-sections (countries). I am aware of xtfisher and
> pescadf as tests that work across unbalanced panels and provide a single
> statistic for the entire dataset. But these are weak tests, and I'd like
> to be able to test individual series by country, in order to see if most
> individual series show signs of stationarity or unit roots.
>
> I've tried -by country: dfuller varname-, -by country: pperron varname-
> and so on with -kpss- and -dfgls- and -levinlin-, but none of these
> commands allow a -by- (or -bysort-) option.
>
> Might there be another command, of which I am not aware, that is up to the
> task? If not, am I left to breaking down my 150-country dataset into 150
> single-country datasets, or by using 150 different -if country- commands?
>
> Jason Webb Yackee
*
* 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/