Statalist


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

Re: st: Getting a varlist of included variables in estimation


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Getting a varlist of included variables in estimation
Date   Tue, 31 Jul 2007 12:42:01 +0100 (BST)

--- Hendri Adriaens <[email protected]> wrote:
> I have a lot of dummies in a dataset. I include them all during
> estimation, but depending on the subsample that I do the estimation
> on, some are dropped automatically due to multicollinarity. I would
> like to quickly test all dummies that are included in the model, with
> a for loop over the included dummies. But how do I get a varlist of
> the included dummies?

-indeplist- (which you can download with -ssc-) will give you a list of
independent variables in your model, but it includes the dropped
variables. The standard error of the dropped variables is returned as 0
(though displayed as .), so you can loop over the variables and only
perform the test on those variables whose _se[] is not 0. See the
example below:

*-------------- begin example -------------
sysuse auto, clear
dummieslab rep78

regress pr rep78_* if foreign == 1
indeplist, local
foreach var of local X {
	if _se[`var'] != 0 {
		test `var'
	}
}
regress pr rep78_* if foreign == 0
indeplist, local
local nodrop ""
foreach var of local X {
	if _se[`var'] != 0 {
		test `var'
	}
}
*--------------- end example --------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
*
*   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/



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