Statalist The Stata Listserver


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

st: RE: detecting a dropped variable programatically


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: detecting a dropped variable programatically
Date   Fri, 19 May 2006 06:34:28 -0500

You could use -_rmcoll- before the regression command is issued to find the
collinear variables.

For example:

sysuse auto,clear
gen p2 = price
local vars  "price weight trunk p2"
_rmcoll `vars'
local vars2 = r(varlist)
local dropped_var : list vars - vars2
disp "`dropped_var'"
reg mpg `vars2'

Scott


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Mark
> Sent: Friday, May 19, 2006 2:55 AM
> To: [email protected]
> Subject: st: detecting a dropped variable programatically
> 
> I am writing a program that runs through potentially tens of thousands
> of regressions.  During this evaluation, I sometimes end up with
> collinear variables.  (Not really, but very nearly collinear, and so
> numerically stata ends up thinking they are.)  I know that I can look
> thru the e(V) matrix looking for a value of zero on the diagonal.  But
> doing this for every regression means another loop inside the main loop
> that may run tens of thousands of times.
> 
> Does anyone know of a way to detect a dropped variable without a loop?
> 
> What would be nice is if the regression routine would return an
> indicator of a dropped variable.  But I dont see this, nor any obvious
> way to find it based on the return values except for searching thru
> e(V).  Any ideas appreciated.
> 
> Thanks!
> 
> Mark
> *
> *   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/


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