Learn R Programming

splm (version 1.6-5)

sphtest: Hausman test for spatial panel data models

Description

Hausman specification test for spatial panel data models

Usage

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

Value

an object of class htest

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

Author

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

Run this code
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

Run the code above in your browser using DataLab