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