Statalist The Stata Listserver

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

st: Re: st Variable dropped from regression: how to capture event?

From   "John P. Bigelow" <J.Bigelow@EconGroup.Com>
To   "Stata ListServe" <>
Subject   st: Re: st Variable dropped from regression: how to capture event?
Date   Sun, 19 Nov 2006 13:52:38 -0500

- --- Friedrich Huebler <> 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
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

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:

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