Hausman type test in R

本小妞迷上赌 提交于 2019-12-03 21:35:08

Update: Be sure to read the comments. Original answer below.

Trial-and-error way of finding this out:

> library(plm)
> 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)

    Hausman Test

data:  form 
chisq = 302.8037, df = 3, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent 

> phtest(re, wi)

    Hausman Test

data:  form 
chisq = 302.8037, df = 3, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent

As you can see, the test yields the same result no matter which of the models you feed it as the first and which as the second argument.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!