Learn R Programming

plm (version 2.6-4)

phtest: Hausman Test for Panel Models

Description

Specification test for panel models.

Usage

phtest(x, ...)

# S3 method for formula phtest( x, data, model = c("within", "random"), effect = c("individual", "time", "twoways"), method = c("chisq", "aux"), index = NULL, vcov = NULL, ... )

# S3 method for panelmodel phtest(x, x2, ...)

Value

An object of class "htest".

Arguments

x

an object of class "panelmodel" or "formula",

...

further arguments to be passed on (currently none).

data

a data.frame,

model

a character vector containing the names of two models (length(model) must be 2),

effect

a character specifying the effect to be introduced to both models, one of "individual", "time", or "twoways" (only for formula method),

method

one of "chisq" or "aux",

index

an optional vector of index variables,

vcov

an optional covariance function,

x2

an object of class "panelmodel" (only for panelmodel method/interface),

Author

Yves Croissant, Giovanni Millo

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 HAUS:78plm. 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 as in WOOL:10;textualplm, Sec.10.7.3. Only the latter can be robustified by specifying a robust covariance estimator as a function through the argument vcov (see Examples).

The effect argument is only relevant for the formula method/interface and is then applied to both models. For the panelmodel method/interface, the test is run with the effects of the already estimated models.

The equivalent tests in the one-way case using a between model (either "within vs. between" or "random vs. between") @see @HAUS:TAYL:81 or @BALT:13 Sec.4.3plm can also be performed by phtest, but only for test = "chisq", not for the regression-based test. NB: These equivalent tests using the between model do not extend to the two-ways case. There are, however, some other equivalent tests, @see @KANG:85 or @BALT:13 Sec.4.3.7plm, but those are unsupported by phtest.

References

HAUS:78plm

HAUS:TAYL:81plm

KANG:85plm

WOOL:10plm

BALT:13plm

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, effect = "time")

# Regression-based Hausman test
phtest(form, data = Gasoline, method = "aux")

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

Run the code above in your browser using DataLab