__Title__

**[P] _ms_balance** -- Adjust **e(b)** by balancing factor-variable covariates

__Syntax__

**_ms_balance** [*indepvars*] [**,** **zero** **strict**]

__Description__

**_ms_balance** is a programmer's command that makes an adjusted copy of **e(b)**
by balancing the specified factor-variable covariates in its column
stripe. The column names in the adjusted copy of **e(b)** will no longer
refer to the variables in *indepvars*, and elements that referenced these
variables will have been multiplied by a fraction representing a
balancing of the levels of the factors in *indepvars*.

__Options__

**zero** specifies that empty cells be treated as true zero estimates with
zero variance. This results in a multiplier of 1/k for each factor
variable in *indepvars*, where k is the number of levels for a given
factor variable in *indepvars*. Interactions containing multiple
variables in *indepvars* will be adjusted by the multiplier from each
participating factor variable.

By default, **_ms_balance** uses a multiplier that ignores empty cells.
An interaction with k levels and e empty cells will have a multiplier
of 1/(k-e) if all its factor variables are in *indepvars*. Otherwise,
the multiplier is determined by the number of nonempty cells for each
level-combination of factor variables not in *indepvars*.

**strict** specifies that an error be raised if there are any empty cells
involving the factor variables in *indepvars*.

__Stored results__

**_ms_balance** stores the following in **r()**:

Matrix
**r(b)** adjusted copy of **e(b)**
**r(mult)** row vector of the multipliers associated with each element
of the original **e(b)**