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

From |
"Sascha O. Becker" <so.b@gmx.net> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: ADF simulation |

Date |
Fri, 9 May 2003 11:43:02 +0200 (MEST) |

Dear statalisters, I have written some code as a basis for simulating the properties of ADF test statistics (following the burn-in method, as Jeff Pitblado called it a day ago) and am getting blind in understanding why I get an error message. When I run the following code (i.e. doing a 1-replication-"simulation" by invoking the below program just once without using the simul command), I get as error message: ( invalid name When I leave out the brackets round r(Zt), I get the message post r not found So, it seems Stata does not recognize the expression r(Zt). Strangely though, when I run a true simulation, i.e. I type simul adfsim3, reps(2000) I get no error message... Does the post stuff only work together with simul or should it also post the DF statistics when just invoking adfsim3 "by hand"? Even if this presumption were true, why is the error message "( invalid name" respectively "post r not found" and not something else? Thanks in advance for any suggestion you might have on this. Ciao, Sascha ************** BEGIN OF CODE ************** program define adfsim3 version 7.0 if "`1'"=="?" { global S_1 "dfull" exit } /* args b1 b2 keep burn sigma */ *args keep burn /* read in: b1 /* coefficient on time trend */ b2 /* coefficient on AR(1) term */ keep /* #obs to be kept after all, i.e. length of the time series after simulation */ burn /* #obs to be burnt after all */ sigma /* standard error */ */ local keep 50 local burn 100 local obs = `keep' + `burn' * drop all variables in memory drop _all * SET NUMBER OF OBSERVATIONS set obs `obs' * DRAW RANDOM NUMBERS FROM N(0,sigma) */ * generate double mynormal= `sigma' * invnorm(uniform()) generate double mynormal= se * invnorm(uniform()) generate time=_n - `burn' tsset time * use the first entry in mynormal as a y(0) and the rest as epsilons generate double y=mynormal in 1 * NOTE: replace works recursively !! replace y=1+b1*time+b2*l.y+mynormal in 2/`obs' * keep the last `keep' obs, i.e. the desired length of the time series keep in -`keep'/l * perform Dickey-Fuller: constant is used as default, otherwise option "noconstant" dfuller y, lags(1) trend post `1' (r(Zt)) end adfsim3 ************** END OF CODE ************** Dr. Sascha O. Becker - Center for Economic Studies Department of Economics - University of Munich Schackstr. 4 - 80539 Munich, Germany -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage! * * 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/

- Prev by Date:
**RE: st: GLLAMM** - Next by Date:
**st: RE: Re: automating a series of equations** - Previous by thread:
**st: automating a series of equations** - Next by thread:
**re: st: ADF simulation** - Index(es):

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