Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: test for stationarity that accepts the "by" command?


From   "Jason Yackee" <jyackee@law.usc.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: test for stationarity that accepts the "by" command?
Date   Thu, 14 Sep 2006 20:25:06 -0700

Scott, thank you much.  This works brilliantly.  

I am still getting a mental handle on all of the syntax, but your code
works and it generally makes sense to me.  Incidentally, Nick's 2002
article discussing how -foreach- works is very helpful for the novice
like me:
http://www.cpc.unc.edu/services/computer/presentations/statatutorial/cox
_article.pdf

Jason

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Scott
Merryman
Sent: Thursday, September 14, 2006 5:07 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: test for stationarity that accepts the "by" command?

-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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Jason Yackee
> Sent: Thursday, September 14, 2006 6:45 PM
> To: statalist@hsphsun2.harvard.edu
> 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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index