Learn R Programming

plm (version 1.5-12)

phtest: Hausman Test for Panel Models

Description

Specification test for panel models.

Usage

phtest(x, ...) "phtest"(x, x2, ...) "phtest"(x, data, model = c("within", "random"), method = c("chisq", "aux"), index = NULL, vcov = NULL, ...)

Arguments

x
an object of class "panelmodel" or "formula",
x2
an object of class "panelmodel",
model
a vector containing the names of two models,
data
a data.frame,
method
one of "chisq" or "aux",
index
an optional vector of index variables,
vcov
an optional covariance function
...
further arguments passed to plm

Value

An object of class "htest".

Details

The Hausman test (sometimes also called Durbin-Wu-Hausman test) is based on the difference of the vectors of coefficients of two different models. The panelmodel method computes the original version of the test based on a quadratic form. The formula method, if method="chisq" (default), computes the original version of the test based on a quadratic form; if method="aux" then the auxiliary-regression-based version in Wooldridge (2010, Sec. 10.7.3.) is computed instead. Only the latter can be robustified specifying a robust covariance estimator as a function through the argument vcov.

References

Hausman, J.A. (1978), Specification tests in econometrics, Econometrica, 46, pp. 1251--1271.

Wooldridge, Jeffrey M. (2010), Econometric analysis of cross-section and panel data, 2nd ed., MIT Press, Sec. 10.7.3., pp. 328--334. Baltagi, Badi H. (2013), Econometric Analysis of Panel Data, 5th ed., John Wiley and Sons., Sec. 4.3.

Examples

Run this code
data("Gasoline", package = "plm")
form <- lgaspcar ~ lincomep + lrpmg + lcarpcap
wi <- plm(form, data = Gasoline, model = "within")
re <- plm(form, data = Gasoline, model = "random")
phtest(wi, re)
phtest(form, data = Gasoline)
phtest(form, data = Gasoline, method = "aux")

# robust Hausman test (regression-based)
phtest(form, data = Gasoline, method = "aux", vcov = vcovHC)

# robust Hausman test with vcov supplied as a
# function and additional parameters
phtest(form, data = Gasoline, method = "aux",
  vcov = function(x) vcovHC(x, method="white2", type="HC3"))

Run the code above in your browser using DataLab