Statalist


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

st: Program ADF test with Perron's procedure


From   Myriam Nourry <[email protected]>
To   [email protected]
Subject   st: Program ADF test with Perron's procedure
Date   Wed, 3 Oct 2007 15:03:53 +0200 (CEST)

Hello Statalist, 

I am trying to write a program to test unit root (ADF
test) by using Perron's procedure to choose the
maximum lag length included in the regression.

The idea is to perform a first regression with 8 lags.
If the absolute value of the t-statistic on the eighth
lagged term is less than -1,645 (i.e., approximate 5%
significance level in an asymptotic normal
distribution), then this term is dropped and the
procedure is repeated for the seventh lagged term. The
procedure is stopped when the last lagged term is
significant, in which case all lesser
first-differenced lagged terms remain in the test, or
zero lagged terms will result.

Therefore, I wrote the following program (this is my
first program...) but it doesn't work and I can't see
the errors. So I need your help !

capture program drop adfperron
*! adfperron v1 Nourry 03oct2007
program define adfperron, rclass
version 9.2
syntax varname(ts) [if] [in] [,Lags(int -1)]
marksample touse

local i Lags
qui dfuller `varname', lags(`i') trend regress 
*/first regression with i lags/
local bstat = �_b[DL`i']� 
local sestat = �_se[DL`i']�
gen tstat = `bstat'/`sestat'
*/computation of the t-stat of the 8th lag/
	while abs(`tstat')< abs(-1.645) & `i'>0 {
	local i=`i'-1
		qui dfuller `varname�, lags(`i') trend regress
		qui replace bstat = �_b[DL`i']�
		qui replace sestat = �_se[DL`i']�
		qui replace tstat = `bstat'/`sestat'
*/while the last lag is not significant, drop it and
do a new regression without this term/
		}
dfuller `varname�, lags(`i�) trend regress
end

When I run this program on Stata, I obtain the
following message : `invalid name r(198)

I hope you can help me to solve this problem.

Thank you
Myriam Nourry


      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
*
*   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