```.-
help for ^dmexogxt^                       (SSC distribution 24 April 2002)
.-

Calculate Davidson-MacKinnon test for consistency of OLS after @xtivreg,fe@
-------------------------------------------------------------------------

^dmexogxt^  [varlist]

^dmexogxt^ is for use after ^xtivreg, fe^; see help @xtivreg@.

Description
-----------

^dmexogxt^ computes a test of exogeneity for a fixed-effect regression
estimated via instrumental variables, the null hypothesis for which states
that an ordinary least squares (OLS) estimator of the same equation
(i.e., ^xtreg, fe^) would yield consistent estimates: that is, any
endogeneity among the regressors would not have deleterious effects on OLS
estimates. A rejection of the null indicates that
endogenous regressors' effects on the estimates are meaningful, and
instrumental variables techniques are required. Davidson and MacKinnon (1993)
demonstrate that this test, which is similar to the (Durbin-Wu-)Hausman test
(see ^hausman^) in this context, will always yield a computable test statistic,
>
whereas the Hausman test, depending on the difference of estimated covariance
matrices being a positive definite matrix, often cannot be computed by standard
>
matrix inverse methods.

The dmexogxt test involves a ordinary least squares regression (using
^xtreg, fe^) of the original dependent variable on the original regressors,
augmented by the residuals from each of the first stage instrumental variables
regressions. This regression gives rise to an F test for the
joint hypothesis that each of the coefficients on the residual series are zero.
>
The test statistic, under the null, is distributed F(m,N-k), where m is the
number of regressors specified as endogenous in the original instrumental
variables regression. A rejection indicates that the instrumental variables
fixed effects estimator should be employed. See Davidson and MacKinnon
(1993, p. 237-240) and Wooldridge (2000, p. 483-484).

As Davidson and MacKinnon (1993, p. 241-242) discuss, the test may be applied
to a subset of the endogenous variables, treating those not specified as
endogenous. In this form, the ^varlist^ contains those variables
which are to be tested, and the degrees of freedom for the test refer to the
number of variables listed.

The command displays the test statistic, numerator and denominator
degrees of freedom and P-value, and places values in the return array.
^return list^ for details.

Example
-------

. ^use auto, clear^
. ^xtivreg price mpg (weight turn=length displ gear_ratio trunk), fe i(
> rep78)^
. ^dmexogxt^
. ^dmexogxt weight^

References
----------

Davidson, R. and MacKinnon, J., Estimation and Inference in Econometrics,
1993, New York: Oxford University Press.

Wooldridge, J., Introductory Econometrics: A Modern Approach, 2000, New York:
South-Western College Publishing.

Acknowledgements
----------------

We are grateful to Ronna Cong, Vince Wiggins and David Drukker of StataCorp for
>
critical review of this module, and to Mark Schaffer for encouraging the develo
> pment
of the subset test. Errors remaining are are own.

Authors
-------

Christopher F Baum, Boston College, USA
baum@@bc.edu

Steven Stillman, RAND Corporation, USA
stillman@@rand.org

Also see
--------

Manual:  ^[R] ivreg^, ^[R] xtivreg^, ^[R] hausman^
On-line:  help for @ivreg@, @xtivreg@, @hausman@, @dmexog@ (if installed)
```