htest_pglm: Specification test for panel glm models

htest_pglmR Documentation

Specification test for panel glm models

Description

This function performs Hausman specification test for panel glm.

Usage

htest_pglm(RE, FE, re.method)

Arguments

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.

Author(s)

Ho Tsung-wu <tsungwu@ntnu.edu.tw>, modifed from phtest() of plm

References

Hausman J.A. (1978). Specification Tests in Econometrics. Econometrica, 46, 1251-1271.

Examples

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")



pdR documentation built on Sept. 11, 2024, 9:08 p.m.