Learn R Programming

plm (version 0.3-1)

phtest: Hausman Test for Panel Models

Description

Specification test for panel models.

Usage

phtest(x, ...)
## S3 method for class 'panelmodel':
phtest(x, x2, ...)
## S3 method for class 'formula':
phtest(x, data, model = c("within","random"),
    effect = "individual", ...)

Arguments

x
an object of class "panelmodel" or "formula",
x2
an object of class "panelmodel",
model
a vector containing the names of two models,
effect
the effects introduced in the model, one of "individual", "time" or "twoways",
data
a data.frame,
...
further arguments.

Value

  • An object of class "htest".

Details

The Hausman test is based on the difference of the vectors of coefficients of two different models.

References

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

Examples

Run this code
data("Gasoline",package="Ecdat")
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)

Run the code above in your browser using DataLab