Statalist


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

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


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Program ADF test with Perron's procedure
Date   Wed, 3 Oct 2007 11:32:37 -0400

Myriam Nourry <[email protected]>:
You seem to have many errors in the program, but I suspect the
immediate problem is that your quotes are not in the form Stata
expects--are you using a text editor to type your program?  A
nonstandard keyboard?  Do the quotes appear normal if the program is
opened in Stata's do-file editor?

If you -set trace on- when you run the program, you will see a lot of
output, some of it informative as to where you have errors.  If you
-set traced 2- you will see slightly less output...

On 10/3/07, Myriam Nourry <[email protected]> wrote:
> 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)
*
*   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