# [R] Hausman test in R

John C Frain frainj at gmail.com
Mon Oct 29 19:46:01 CET 2012

```On 29 October 2012 16:56, fxen3k <f.sehardt at gmail.com> wrote:

snip

If we are talking about the same test a Hausman test can not be
applied to OLS regressions.  As you have already been told you must
have two estimates of the same set of coefficients to do a Hausman
test.

Suppose that you do OLS  and an IV estimates of a particular
regression you will get twu estimates of the coefficients in the
model. If the disturbances are not correlated with the explanatory
variables (no endogeneity) the two sets of coefficients will no be
similar.  If there is endogeneity the coefficients will be different.
The Hausman test is a test of the null that the coefficients are not
different.   If the null is accepted you will probably accept the OLS
regression. If the null is rejected you may consider the IV estimate.

A Hausman test is applicable in many other situations (fixed v random
effects etc.)  You may have problems with the estimate of the
covariance matrix used in the test as on occasion as, due to numerical
problems, the estimates of that matrix are not always positive
definite.

Most intermediate level econometrics textbooks will have a good
account of the Hausman test. Green(2012), Econometric Analysis 7th
edition, Prentice Hall. contains a comprehensive discussion of these
matters which you might read.  It is not easy but if you master the
are likely to be answered on this forum.

Best Regards

John

> I cannot imagine, no one in this forum has ever done a Hausman test on OLS
> regressions.
> I read in the systemfit package and found only this example referring to
> 2SLS and 3SLS regressions:
>
> data( "Kmenta" )
> eqDemand <- consump ~ price + income
> eqSupply <- consump ~ price + farmPrice + trend
> inst <- ~ income + farmPrice + trend
> system <- list( demand = eqDemand, supply = eqSupply )
> ## perform the estimations
> fit2sls <- systemfit( system, "2SLS", inst = inst, data = Kmenta )
> fit3sls <- systemfit( system, "3SLS", inst = inst, data = Kmenta )
> ## perform the Hausman test
> h <- hausman.systemfit( fit2sls, fit3sls )
> print( h )
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Hausman-test-in-R-tp4647716p4647774.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.

--
John C Frain
Economics Department
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:frainj at tcd.ie
mailto:frainj at gmail.com

```