Bookmark and Share

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]

st: postfile and loop with decreasing number of variables


From   Maximiliano Méndez Parra <[email protected]>
To   [email protected]
Subject   st: postfile and loop with decreasing number of variables
Date   Mon, 8 Mar 2010 12:18:18 +0000

Dear all,

I am trying inside a loop to postfile a couple of results from different
regressions. The problem is this. When I use postfile you need to predefine
(in postfile) all the variables that will be created. However, my program
decreases the lag length of the dependent variable in every loop. Therefore,
when you post the results in the second iteration of the loop, post is
looking for a value to paste in fe4 that does not exist.

What I need at the end is for the 4 regressions (one for each loop) I want
to get the significance of each lag in a file. So in the regression with a
lag up to 4 I want to get the t-stat for the first, second, third and fourth
lag; in the regression with a lag up to 3, the t-stat for the first, second
and third lag; and so on.

Here is my code. Any ideas? Thanks in advance.



tempname aa
tempfile bb
postfile `aa' fe4 fe3 fe2 fe1 using `bb'
forvalues i=4(-1)1 {
reg y …………… l(1/`i').y
sca ee`i'=(_coef[l`i'.y])/_se[l`i'.y]
post `hdle' (ee`i')
}
postclose  `hdle'

--
Maximiliano Méndez Parra
[email protected]

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index