Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Loop over regression estimates


From   [email protected]
To   [email protected]
Subject   st: Loop over regression estimates
Date   Sun, 27 Sep 2009 00:05:57 +0200

Dear all,

I have to conduct a simple Wald test (-test x1=x2=x3=x4=0-) for several different regression specifications. I have done the regressions and stored the estimates under a name that identifies the hypothesis, the model and the dependent variable (e.g. h1m1a). Now I would like to write a loop over all stored estimates, conduct the tests and store the F-stat and the p-value in order to export them later by means of -outreg2-. I have tried the loop, listed below, but unfortunately Stata says that the syntax is wrong. The problem lies probably in the foreach-command but I don't know which other loop to take for regression estimates and whether it is possible at all.

Here is what I tried:

local hyp1 "h1m4s h1m4a h1m4t h1m4z"
foreach est of hyp1 {
	estimates restore `est'
	test x1=x2=x3=x4=0
	local F_`est'=r(F)
	local P_`est'=r(p)
}

I would appreciate any help or references where I can read how to make it.

Best regards,
Ida
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index