sphtest: Hausman test for spatial panel data models

sphtestR Documentation

Hausman test for spatial panel data models

Description

Hausman specification test for spatial panel data models

Usage

sphtest(x, ...)
## S3 method for class 'formula'
sphtest(x, data, index = NULL, listw,
      spatial.model = c("lag", "error", "sarar"),
      method = c("ML", "GM"), errors = c("KKP", "BSK"),...)
## S3 method for class 'splm'
sphtest(x, x2, ...)

Arguments

x

an object of class formula or splm

x2

an object of class splm

data

an object of class data.frame or pdata.frame. An optional data frame containing the variables in the model. When the obect is a data.frame, the first two columns may contain the indexes. See index

index

if not NULL (default), a character vector to identify the indexes among the columns of the data.frame

listw

an object of class listw created for example by spdep::nb2listw

spatial.model

one of c("lag","error","sarar"), the model to be estimated (only lag, only error, both lag and error dependence)

method

one of c("ML","GM")

errors

one of c("BSK","KPP"). When method is "ML" defines the specification of the innovations

...

additional arguments to be passed

Value

an object of class htest

Author(s)

Gianfranco Piras

References

Millo, G., Piras, G. (2012) splm: Spatial Panel Data Models in R. Journal of Statistical Software, 47(1), 1–38. URL http://www.jstatsoft.org/v47/i01/.

See Also

spgm

Examples

data(Produc, package="plm")
data(usaww)
fm <- log(gsp)~log(pcap)+log(pc)+log(emp)+unemp
test1<-sphtest(fm,data=Produc, listw = spdep::mat2listw(usaww),
                spatial.model = "error", method="GM")
test1
mod1<- spgm(fm, data=Produc, listw = usaww, model = "random",
             spatial.error = TRUE, moments="fullweights")
mod2<- spgm(fm, data=Produc, listw = usaww, model = "within",
             spatial.error = TRUE)
test2<-sphtest(mod1, mod2)
test2

splm documentation built on Dec. 12, 2023, 3:03 a.m.

Related to sphtest in splm...