Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: _rmcoll query

From   Roger Newson <>
Subject   Re: st: _rmcoll query
Date   Thu, 17 Feb 2005 12:33:33 +0000

Thanks to Bill once again for his very prompt and helpful advice. I will no doubt be using it in future programs using -rmcoll-, and looking into his previous writings about -syminv-.

Best wishes


At 14:20 16/02/2005, Bill Gould wrote:

Roger Newson <> asked

> Can I assume that, in general, this is how -_rmcoll- works? And, if not,
> then how does it work?

after speculating.

Let varlist contain a set of variable names, among which we want to find
the noncolinear subset.  Stata forms syminv((X-mean(X)'(X-mean(X)) (default,
syminv(X'X) if option -noconstant- is specified) and then searches along the
diagonal for zero values, which correspond to the collinear variables.  Thus,
-_rmcoll- lets syminv() do the heavy lifting, which was not only convenient to
program but also guaranteed that -_rmcoll- would produce results consistent
with those of -regress- and all of Stata's other estimation commands.

syminv() is Stata's symmetric-matrix inversion routine.  I have written before
about how syminv() works.  In a nutshell, syminv() decides which of a
collinear set of variables to drop based on numerical accuracy considerations;
it does *NOT* proceed from left to right, as Roger speculated.

Roger observed that if the same variable appeared in varlist more than
once, the rightmost one was dropped.  In general, that will happen in the
equal-variable case because syminv() searches from left to right every step of
the way, but I cannot guarantee the rightmost result because, in earlier
steps, operations are performed on the matrix and the order in which the
operations were performed depends on the location of the row/column.

-- Bill
*   For searches and help try:

Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605

Opinions expressed are those of the author, not the institution.

*   For searches and help try:

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