- --- Friedrich Huebler <[email protected]> wrote:
> I am running a loop of regressions that should only be completed when
> all variables are included. In case a variable is dropped I want to
> skip the rest of the loop and continue with the next regression.
> The regression still runs, but with an incomplete set of variables.
> How can I check whether a variable was dropped?
As an alternative to some of the suggestions that have been offered already,
you could test the variable list without even running the regression by
using the - _rmcoll - command. or - _rmdcoll - command.
Say you want to regress Y on X1 X2 X3, but only if the X variables are
non-collinear.
Before running the regression set up with
local depvar = "X1 X2 X3"
then run
_rmcoll `depvar'
_rmcoll will return in r(varlist) a list of non-collinear variables found in
`depvar'
If `r(varlist)' and `depvar' are the same go ahead and run
reg Y `depvar'
otherwise skip it.
John Bigelow
--
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.431 / Virus Database: 268.14.7/538 - Release Date: 11/18/2006
4:48 PM
*
* 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/