__Title__

**[P] _rmcoll2list** -- Programmer's command to check for collinearity in the
union of two lists of variables

__Syntax__

**_rmcoll2list,** **alist(***varlist***)** **blist(***varlist***)** **normwt(***varname***)**
**touse(***varname***)** [**name(***string***)**]

*options* Description
-------------------------------------------------------------------------
**alist(***varlist***)** first list of variables
**blist(***varlist***)** second list of variables
**normwt(***varname***)** normalized weight variable
**touse(***varname***)** marks estimation sample
**name(***string***)** used to label output
-------------------------------------------------------------------------

__Description__

**_rmcoll2list** takes two lists of variables, A and B; forms the union of
the two lists; and then checks for collinearity, removing variables in
the B list if necessary to obtain a linearly independent set. The
variables in A are assumed to be linearly independent, as are the
variables in B; you must use **_rmcoll** or some such on each list
individually before calling **_rmcoll2list**. Returned in **r(blist)** is the
subset of the B list that together with the A list forms a linearly
independent set of variables.

__Options__

**alist(***varlist***)** contains the first list of variables.

**blist(***varlist***)** contains the second set of variables. These variables are
considered for elimination to obtain a linearly independent set.

**normwt(***varname***)** contains a normalized weight variable. If your command
takes **fweight**s, **pweight**s, **aweight**s, or **iweight**s, you must create a
new variable containing the normalized weights, where the
normalization process is discussed in *Methods and formulas* of **[R]**
**regress**. This is necessary because Mata understands only one type of
weight variable. If your command does not accept weights, create a
temporary variable containing one for every observation.

**touse(***varname***)** contains a 0/1 variable that marks the estimation sample.

**name(***string***)** controls how dropped variables are labeled. See *Remarks*
below.

__Remarks__

**_rmcoll2list** is used to form a linearly independent set of variables from
two smaller sets of linearly independent variables, removing variables
from the second list if necessary. For example, **ivregress** first checks
that the set of endogenous and included exogenous regressors are not
collinear. It then checks that the additional instruments are not
collinear. Finally, it calls **_rmcoll2list** to ensure that the endogenous,
exogenous, and instrumental variables are not collinear, eliminating
instruments if necessary to avoid collinearity. By using **_rmcoll2list**
instead of **_rmcoll**, we ensure that additional instruments are eliminated
(if necessary) and that our noncollinear set of endogenous and exogenous
regressors is kept intact.

If the **name(***string***)** option is not specified and a member of the second
list must be removed, the message

note: *varname* dropped because of collinearity

is displayed. If you specify, say, **name(inst)**, because your command has
an option named **inst()**, the error message is

note: *varname* dropped from inst() because of collinearity