{smcl}
{* 16jun2003}{...}
{hline}
help for {hi:hausman}{right:manual:  {hi:[R] hausman}}
{right:dialog:  {dialog hausman}    }
{hline}

{title:Hausman specification test}

{p 8 16 2}{cmd:hausman} {it:name-consistent} [{it:name-efficient}]
[{cmd:,}
  {cmdab:c:onstant}
  {cmdab:a:lleqs}
  {cmdab:sk:ipeqs:(}{it:eqlist}{cmd:)}
  {cmdab:eq:uations:(}{it:matchlist}{cmd:)}
  {cmdab:sig:mamore}
  {cmd:force}
  {cmdab:tcon:sistent:(}{it:string}{cmd:)}
  {cmdab:teff:icient:(}{it:string}{cmd:)}
  {cmd:df(}{it:#}{cmd:)}
]

{p 4 4 2}
{it:name-consistent} and {it:name-efficient} are names under which estimation
results were saved via {help estimates:estimates store}.  A period ({cmd:.})
may be used to refer to the last estimation results, even if these were not
already stored.  Not specifying {it:name-efficient} is equivalent to
specifying the last estimation results ({cmd:.}).


{title:Description}

{p 4 4 2}
{cmd:hausman} performs Hausman's (1978) specification test.  To use {cmd:hausman},
one has to perform the following steps.

{p 6 10 2}(1) obtain an estimator that is {hi:consistent} whether or not the
              hypothesis is true;
{p_end}
{p 6 10 2}(2) store the estimation results under a {it:name-consistent} using
              {help estimates:estimates store};
{p_end}
{p 6 10 2}(3) obtain an estimator that is {hi:efficient} (and {hi:consistent})
              under the hypothesis that you are testing, but {hi:inconsistent}
              otherwise;
{p_end}
{p 6 10 2}(4) store the estimation results under a {it:name-efficient} using
              {help estimates:estimates store};
{p_end}
{p 6 10 2}(5) use {cmd:hausman} to perform the test

{p 14 14 2}{cmd:hausman} {it:name-consistent} {it:name-efficient} [{cmd:,} {it:options}]

{p 4 4 2}
The order of computing the two estimators may be reversed. You have to be
careful though to specify to {cmd:hausman} the models in the order
"always consistent" first and "efficient under H0" second. It is possible
to skip storing the second model and refer to the last estimation results
by a period ({cmd:.}).

{p 4 4 2}
{cmd:hausman} may be used in any context.  The order in which you specify
the regressors in each model does not matter, but it is your responsibility
to assure that the estimators and models are comparable, and satisfy the
theoretical conditions (see (1) and (3) above).


{title:Options}

{p 4 8 2}{cmd:constant}
    specifies that the estimated intercept(s) are to be included in the
    model comparison; by default they are excluded.  The default behavior
    is appropriate for models where the constant does not have a common
    interpretation across the two models.

{p 4 8 2}{cmd:alleqs}
    specifies that all of the equations in the models be used to perform the
    Hausman test; by default only the first equation is used.

{p 4 8 2}{cmd:skipeqs(}{it:eqlist}{cmd:)}
    specifies in {it:eqlist} the names of equations to be excluded from
    the test.  Equation numbers are not allowed in this context as it
    is the equation names, along with the variable names, that are used
    to identify common coefficients.

{p 4 8 2}{cmd:equations(}{it:matchlist}{cmd:)}
    specifies, by number, the pairs of equations that are to be compared,
    and should have the syntax

{p 12 20 2}
{it:#c}{cmd::}{it:#e} [{cmd:,} {it:#c}{cmd::}{it:#e}[{cmd:,} {it:...}]]

{p 8 8 2}where {it:#c} ({it:#e}) is an equation number of the
    always-consistent (efficient under H0) estimator.  For instance
    {cmd:equations(1:1)}; {cmd:equations(1:1,2:2)}; or {cmd:equations(1:2)}.
    If {cmd:equations()} is not specified, equations are matched on equation
    names.

{p 8 8 2}{cmd:equations()} handles the situation when one estimator uses
    equation names and the other does not.  For instance,
    {cmd:equations(1:1)} means equation 1 is to be tested against equation
    1.  {cmd:equations(1:1, 2:2)} means equation 1 is to be tested against
    equation 1 and equation 2 against equation 2.  {cmd:equations(1:2)}
    means equation 1 of the always consistent estimator is to be tested
    against equation 2 of the efficient-under-H0 estimator.  If
    {cmd:equations()} is specified, options {cmd:alleqs} and {cmd:skipeqs}
    are ignored.

{p 4 8 2}{cmd:sigmamore}
    allows you to specify that the (co)variance matrices used in the test
    be based on a common estimate of disturbance variance (sigma2), namely
    the variance from the efficient estimator.  This option provides a
    proper estimate of the contrast variance for so-called tests of
    exogeneity and over-identification in instrumental variables regression.
    This option can only be specified when both estimators save {hi:e(sigma)}
    or {hi:e(rmse)}.

{p 4 8 2}{cmd:force}
    specifies that the Hausman test is performed even though the assumptions
    of the Hausman test seem not to be met; e.g., because the estimators
    were p-weighted.

{p 4 8 2}{cmd:tconsistent(}{it:str}{cmd:)} and {cmd:tefficient(}{it:str}{cmd:)}
    are formatting options.  They allow you to specify the headers of the
    columns of coefficients that default to the names of the models.  These
    options will be primarily of interest to programmers.

{p 4 8 2}{cmd:df(}{it:#}{cmd:)}
    specifies the degrees of freedom for the Hausman test.  The default is
    the matrix rank of the variance of the difference between the coefficients 
    of the two estimators.


{title:Examples}

    Typing

{p 8 12 2}{cmd:. xtreg lny educ age, fe}{p_end}
{p 8 12 2}{cmd:. est store fixed}{p_end}
{p 8 12 2}{cmd:. xtreg lny educ age sex, re}{p_end}
{p 8 12 2}{cmd:. hausman fixed .}

{p 4 4 2} presents Hausman's (1978) specification test which tests the
appropriateness of the random-effects estimator {cmd:xtreg, re}.

    Typing

{p 8 12 2}{cmd:. mlogit travmode age gender income}{p_end}
{p 8 12 2}{cmd:. est store all}{p_end}
{p 8 12 2}{cmd:. mlogit travmode age gender income, if travmode != 2}{p_end}
{p 8 12 2}{cmd:. est store partial}{p_end}
{p 8 12 2}{cmd:. hausman partial all, alleqs constant}

{p 4 4 2}will perform a Hausman test for independence of irrelevant
alternatives (IIA).

{p 4 4 2}When one estimator uses equation names and the other does not,
specify the {cmd:equations()} option to force the
comparison.  This is illustrated in the comparison of the OLS estimator
and the estimator of the {cmd:regress} part of the {cmd:heckman} model

{p 8 12 2}{cmd:. regress mpg price}{p_end}
{p 8 12 2}{cmd:. est store reg}{p_end}
{p 8 12 2}{cmd:. heckman mpg price, sel(foreign=weight)}{p_end}
{p 8 12 2}{cmd:. hausman reg ., eq(1:1)}

{p 4 4 2}Comparison of the {cmd:probit} and the selection model of the
{cmd:heckman}

{p 8 12 2}{cmd:. probit foreign weight}{p_end}
{p 8 12 2}{cmd:. est store probit_for}{p_end}
{p 8 12 2}{cmd:. heckman mpg price, sel(foreign=weight)}{p_end}
{p 8 12 2}{cmd:. hausman probit_for ., eq(1:2)}

{p 4 4 2}Multiple comparison with the {cmd:equations()} option

{p 8 12 2}{cmd:. reg3 (weight mpg price = foreign rep)}{p_end}
{p 8 12 2}{cmd:. est store full}{p_end}
{p 8 12 2}{cmd:. reg3 (mpg price = foreign rep)}{p_end}
{p 8 12 2}{cmd:. hausman . full, eq(1:2, 2:3)}


{title:Remark: An alternative to {cmd:hausman}}

{p 4 4 2}
The assumption that one of the estimators is efficient (i.e., has minimal
asymptotic variance) is a demanding one.  It is violated, for instance, if
your observations are clustered or pweighted, or if your model is somehow
misspecified.  Moreover, even if the assumption is satisfied, there may be
a "small sample" problem with the Hausman test.  Hausman's test is based
on estimating the variance var(b-B) of the difference of the estimators
by the difference var(b)-var(B) of the variances.  Under the assumptions
(1) and (3), var(b)-var(B) is a consistent estimator of var(b-B), but
it is not necessarily positive definite "in finite samples", i.e., in your
application.  If this is the case, the Hausman test is undefined.
Unfortunately, this is not a rare event.  Stata supports a generalized
Hausman test that overcomes both of these problems.  See {help suest} for
details.


{title:Also see}

    Manual:  {hi:[R] hausman}

{p 4 13 2}Online:  help for {help suest}; {help lrtest}, {help test}
