htest_pglm | R Documentation |
This function performs Hausman specification test for panel glm.
htest_pglm(RE, FE, re.method)
RE |
Random effect objects. Support pglm, glmer, glmmTMB |
FE |
Fixed effect objects. |
re.method |
Method that used to estimate the random effect estimation, in addition to "pglm", it also supports "glmmTMB" of package glmmTMB, and "glmer" of package lme4. |
Ho Tsung-wu <tsungwu@ntnu.edu.tw>, modifed from phtest() of plm
Hausman J.A. (1978). Specification Tests in Econometrics. Econometrica, 46, 1251-1271.
data(ship)
library(pglm)
Eq1="accident ~ op_75_79+co_65_69+co_70_74+co_75_79"
FE.pois <- pglm(Eq1,data=ship,family = "poisson",model = "within",index = 'ship',R=10)
RE.pois <- pglm::pglm(Eq1,data=ship,family = "poisson", model = "random", index = 'ship')
## Hausman test
htest_pglm(RE=RE.pois, FE=FE.pois, re.method="pglm")
Eq2=accident ~ op_75_79+co_65_69+co_70_74+co_75_79 + (1 | ship)
re.glmmTMB=glmmTMB::glmmTMB(Eq2,data=ship, family="poisson")
## Hausman test
htest_pglm(RE=re.glmmTMB, FE=FE.pois, re.method="glmmTMB")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.