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

From |
"Dev Vencappa" <[email protected]> |

To |
<[email protected]> |

Subject |
RE: st: looping with augmented dickey fuller test |

Date |
Wed, 15 Oct 2003 15:06:07 +0100 |

Nick, I probably failed to mention it but in a separate stage, I am appending all the 76 diferent files together into one file where I have the company code, it's optimal lag length (selected in a separate exercise based on AIC) and the dickey fuller statistic. When you mentioned that the results should belong together, you are right, except that the dickey fuller method does not seem to work on panel data. I have to keep the relevant company, tsset the data to year, and save the results (thus producing 76 different files, that I append together into one final file). The whole point behind this exercise is to compare individual unit root tests with panel unit root tests that I have computed for the same variables. I am copying the whole loop below. I am sure you will suggest a shorter way to write that. local z "netprem disclm elr solv" foreach k of local z{ forvalues x=1/19{ preserve keep if comcode==`x' tsset year postfile myhandledf lags`k' comcode dfstat`k' using "c:\unitroot\dfunitrootlag`k'comp`x'", replace summ AICoptlag`k' if comcode==`x', mean dfuller `k', lags(`r(mean)') reg scalar LAGS`k'=AICoptlag`k' scalar DFSTAT`k'=r(Zt) post myhandledf (LAGS`k') (`x') (DFSTAT`k') postclose myhandledf restore } postutil clear } local z "netprem disclm elr solv" foreach k of local z{ use "c:\unitroot\dfunitrootlag`k'comp1", clear forvalues x = 2/19 { append using "c:\unitroot\dfunitrootlag`k'comp`x'" } save "c:\unitroot\dfunitrootlag`k'allcomp", replace } use "c:\unitroot\dfunitrootlagnetpremallcomp", clear local z "disclm elr solv" foreach k of local z{ joinby comcode using "c:\unitroot\dfunitrootlag`k'allcomp" } save "c:\unitroot\dfunitrootlagallcomp", replace Many thanks Dev Dev Vencappa School of Economics University of Nottingham University Park Nottingham NG7 2RD U.K. Tel : +44 (0)115 951 5608 Fax: +44 (0) 115 951 4159 >>> [email protected] 10/15/03 2:40 PM >>> Dev Vencappa > > Ernest, Nick > many thanks to you both for your solutions which work > finely. I have rewritten the command to accomodate my > dataset based on what one of you suggested as follows: > > local z "netprem disclm elr solv" > foreach k of local z{ > forvalues x=1/19{ > preserve > keep if comcode==`x' > tsset year > postfile myhandledf comcode dfstat`k' using > "c:\unitroot\dfunitrootlag`k'comp`x'", replace > summ AICoptlag`k' if comcode==`x', mean > dfuller `k', lags(`r(mean)') reg > scalar DFSTAT`k'=r(Zt) > post myhandledf (`x') (DFSTAT`k') > postclose myhandledf > restore > } > postutil clear > } > > > Above seems to be doing exactly what I wanted it to do. Thanks for this. If I understand you correctly, you are splitting the results of one analysis among 76 different files. I guess that questions can go validly in both directions, and I'm very curious here. Why is this what you want to do? Don't these results belong together? 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/ * * 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/

**Follow-Ups**:**RE: st: looping with augmented dickey fuller test***From:*"Nick Cox" <[email protected]>

- Prev by Date:
**st: RE: RE: ? loop** - Next by Date:
**st: RE: a tabulate question.** - Previous by thread:
**RE: st: looping with augmented dickey fuller test** - Next by thread:
**RE: st: looping with augmented dickey fuller test** - Index(es):

© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |