| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Flagging estimation errors in -ivreg2-
On Feb 11, 2007, at 3:16 PM, Maarten buis wrote:
1. Some regressors are dropped [due] to perfect collinearity. (This
colinearity is not trivial, such as two identical regressors or a set
of dummies reproducing the constant; hence such regressions are very
difficult to identify ex ante.)
-_rmcoll- may be a partial answer.
Thanks for the suggestion, Maarten. However, -_rmcoll- drops the
collinear variables (according to -help _rmcoll-), which -ivreg2-
already does by itself. What I actually need is to be notified when
this happens. -quietly capture ivreg2- doesn't provide any
indication that collinearity (or any other problem, short of an error
that stops estimation) has occurred.
2. The VCV matrix fails a rank condition; the error message
displayed on the screen when estimated -noisily- is below.
"Error: estimated covariance matrix of moment conditions not of
full rank;
overidentification statistic not reported, and standard
errors and
model tests should be interpreted with caution.
"Possible causes:
covariance matrix of moment conditions not positive definite
covariance matrix uses too many lags
singleton dummy variable (dummy with one 1 and N-1 0s or
vice versa)"
After some poking around and some trial-and-error, I have discovered
that -ivreg2- does (indirectly) provide information in e(scalars) and
e(macros) that I may be able to exploit. For example, it appears
that I can flag the less-than-full rank of e(V) with the following
code after an -ivreg2- call:
if e(rankV) < e(rankxx) {
noi disp "*** Error: deficient rank of VCV matrix."
}
Also, variables dropped in -ivreg2- due to collinearity are listed in
e(collin); otherwise e(collin) is not created. So I am able to flag
the existence of e(collin) with the following code:
if ~missing(e(collin)) {
noi disp "*** Error: perfect collinearity."
}
These two code blocks seem to work OK; they flag the problems in the
log file rather than the tables, but I can live with that. (It would
appear to require some significant re-writing of the table code --
based on repeated -matlist- calls -- to do otherwise.)
Alternative approaches are welcome; I'm sure I'll learn some more
coding tricks from them. Thanks!
-- Mike
*
* 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/