Statalist


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

st: RE: RE: Program ADF test with Perron's procedure


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Program ADF test with Perron's procedure
Date   Wed, 3 Oct 2007 15:05:01 +0100

This comment

*/computation of the t-stat of the 8th lag/

should be 

/* computation of the t-stat of the 8th lag */

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Nick Cox
> Sent: 03 October 2007 14:54
> To: [email protected]
> Subject: st: RE: Program ADF test with Perron's procedure
> 
> 
> Although 
> 
> syntax varname
> 
> is fine as a variant on 
> 
> syntax varlist
> 
> -syntax- still populates the -varlist- 
> macro with whatever you supplied
> as varname. No local macro -varname-
> is defined by -syntax-. 
> 
> Thus I guess that 
> 
> qui dfuller `varname',
> 
> should be 
> 
> qui dfuller `varlist',
> 
> A separate bug in your program is 
> that you allow -if- and -in- but 
> do nothing to let them take effect. 
> Various commands need to be made 
> 
> ... if `touse' 
> 
> Another bug is 
> 
> local i Lags
> 
> which should be 
> 
> local i = `lags' 
> 
> Another class of bugs is confusion between tstat 
> and `tstat', etc. And there are some typos. 
> 
> I note tacit assumptions about what your variables 
> are called (DL*). 
> 
> Here is a hack. 
> 
> capture program drop adfperron
> * NJC was here 
> *! adfperron v1 Nourry 03oct2007
> program adfperron, rclass
> 	version 9.2
> 	syntax varname(ts) [if] [in] [,Lags(int -1)]
> 	marksample touse
> 	qui count if `touse' 
> 	if r(N) == 0 error 2000 
> 
> 	local i = `lags' 
> 	qui dfuller `varlist' if `touse', lags(`i') trend regress 
> 	*/first regression with i lags/
> 
> 	local bstat = _b[DL`i']
> 	local sestat = _se[DL`i']
> 	local tstat = `bstat'/`sestat'
> 
> 	*/computation of the t-stat of the 8th lag/
> 
>  	qui while abs(`tstat')< 1.645 & `i' > 0 {
> 		local i = `i' - 1
>  		dfuller `varlist' if `touse', lags(`i') trend regress
>  		local bstat = _b[DL`i']
>  		local sestat = _se[DL`i']
>  		local tstat = `bstat'/`sestat'
>  /* while the last lag is not significant, drop it and
>  do a new regression without this term */
>  	}
> 
> 	dfuller `varlist' if `touse', lags(`i') trend regress
> end
> 
> Nick 
> [email protected] 
> 

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