Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: RE: do file: t-score, dfuller, to sw regress
From
Robert A Yaffee <[email protected]>
To
[email protected]
Subject
Re: st: RE: RE: do file: t-score, dfuller, to sw regress
Date
Fri, 10 Dec 2010 07:18:33 GMT
Steven,
If you are interested in optimizing the program, you might consider
substituting the Elliot, Rothenberg, Stock (dfgls) test for the DF
or ADF test. The power properties of the dfgls test are far superior
to those of the Dickey-Fuller test, according to Madalla and Kim (2003)
in Unit Roots, Cointegration and Structural Change.
If you have structural breaks or multiple roots the problem of
power in the DF and ADF tests becomes more salient. Bai and
Perron have written about this as have Dickey and Pantula. The
Zivot and Andrews test also in SSC might be of use here.
This point was noted by Chris Baum, who suggested the possibility
of using the (urcovar) module in the SSC library, as the covariate
adjusted Dickey Fuller test at the Boston Stata User's Group meeting
a few years ago, as an alternative to the DF and ADF tests.
Regards,
Bob Yaffee
Robert A. Yaffee, Ph.D.
Research Professor
Silver School of Social Work
New York University
Biosketch: http://homepages.nyu.edu/~ray1/Biosketch2009.pdf
CV: http://homepages.nyu.edu/~ray1/vita.pdf
----- Original Message -----
From: steven quattry <[email protected]>
Date: Thursday, December 9, 2010 8:17 pm
Subject: st: RE: RE: do file: t-score, dfuller, to sw regress
To: [email protected]
> Thank you Nick for your comments, and apologies to all for being
> unclear. I fully understand if this leads many to ignore my original
> post. However if I may re-attempt to explain, essentially I have a
> do-file created with the help of Statlist contributors that performs
> bi-variate regressions, sorts the independent variables by t-score
> and removes those below a certain threshold. It then runs a Dfuller
> test and further removes variables that do not pass the critical
> level, and finally there is code that essentially removes any
> variables that have blanks. I would like to be able to learn of a way
> to then take this output and sort the resulting variables by t-score,
> then keep only the 72 variables with the highest t-score, and run a sw
> regress with those variables. My current code is below. Again, I
> sincerely apologize for being unclear and would appreciate any
> feedback but understand if I do not receive any.
>
> Also Nick, I assume you do not have the time to go into the
> spuriousness of the above process, but if you were able to direct me
> to a certain chapter in a well known stats text, or even an online
> resource I would be quite thankful, however I fully understand it is
> not your role.
>
> Thank you for your consideration,
> -Steven
>
>
> I am using Stata/SE 11.1 for Windows
>
> * 2.1 T-test and Dickey-Fuller Filter
> **************************************
>
> drop if n<61
>
> tsset n
> tempname memhold
> tempname memhold2
> postfile `memhold' str20 var double t using t_score, replace
> postfile `memhold2' str20 var2 double df_pvalue using df_pvalue, replace
>
> foreach var of varlist swap1m-allocglobal uslib1m-infdify
> dswap1m-dallocglobal6 {
> qui reg dhealth `var'
> matrix e =e(b)
> matrix v = e(V)
> local t = abs(e[1,1]/sqrt(v[1,1]))
> if `t' < 1.7 {
> drop `var'
> }
> else {
> local mylist "`mylist' `var'"
> post `memhold' ("`var'") (`t')
> }
> }
> postclose `memhold'
>
> foreach l of local mylist {
> qui dfuller `l', lag(1)
> if r(p) > .01 {
> drop `l'
> }
> else {
> local mylist2 "`mylist2' `l'"
> post `memhold2' ("`l'") (r(p))
> }
> }
> postclose `memhold2'
> keep `mylist2'
> log on
> use t_score,clear
> gsort -t
> l
> use df_pvalue, clear
> l
> log off
> restore
>
> * 2.2 Missing data Filter
> **************************
> preserve
> drop if n<61
>
> foreach x of varlist `mylist2' {
> qui sum `x'
> if r(N)<72 {
> di in red "`x'"
> drop `x'
> }
> else {
> local myvar "`myvar' `x'"
> }
> }
>
> sum date
> keep if date==r(max)
>
> foreach x of varlist `myvar' {
> if `x'==. {
> drop `x'
> }
> else {
> local myvar2 "`myvar2' `x'"
> }
> }
> log on
> d `myvar2'
> log off
> restore
>
>
> * 2.3 Stepwise Regressions
> ***************************
>
> preserve
> drop if n<61
>
> *Simultaneous Model
> local x "Here is where I paste in variables after sorting by
> t-score and keeping only 72 highest"
>
>
> log on
> sw reg dhealth `x', pe(0.05)
>
>
> vif
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/