LR.sarlm: Likelihood ratio test

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/LR.spsarlm.R

Description

The LR.sarlm() function provides a likelihood ratio test for objects for which a logLik() function exists for their class, or for objects of class logLik. LR1.sarlm() and Wald1.sarlm() are used internally in summary.sarlm(), but may be accessed directly; they report the values respectively of LR and Wald tests for the absence of spatial dependence in spatial lag or error models. The spatial Hausman test is available for models fitted with errorsarlm and GMerrorsar.

Usage

1
2
3
4
5
6
7
8
9
LR.sarlm(x, y)
## S3 method for class 'sarlm'
logLik(object, ...)
LR1.sarlm(object)
Wald1.sarlm(object)
## S3 method for class 'sarlm'
Hausman.test(object, ..., tol=NULL)
## S3 method for class 'gmsar'
Hausman.test(object, ..., tol=NULL)

Arguments

x

a logLik object or an object for which a logLik() function exists

y

a logLik object or an object for which a logLik() function exists

object

a sarlm object from lagsarlm() or errorsarlm()

...

further arguments passed to or from other methods

tol

tol argument passed to solve, default NULL

Value

The tests return objects of class htest with:

statistic

value of statistic

parameter

degrees of freedom

p.value

Probability value

estimate

varies with test

method

description of test method

logLik.sarlm() returns an object of class logLik LR1.sarlm, Hausman.sarlm and Wald1.sarlm returm objects of class htest

Note

The numbers of degrees of freedom returned by logLik.sarlm() include nuisance parameters, that is the number of regression coefficients, plus sigma, plus spatial parameter esitmate(s).

Author(s)

Roger Bivand Roger.Bivand@nhh.no

References

LeSage J and RK Pace (2009) Introduction to Spatial Econometrics. CRC Press, Boca Raton, pp. 61–63; Pace RK and LeSage J (2008) A spatial Hausman test. Economics Letters 101, 282–284.

See Also

logLik.lm, anova.sarlm

Examples

1
2
3
4
5
6
example(columbus)
mixed <- lagsarlm(CRIME ~ HOVAL + INC, data=columbus, nb2listw(col.gal.nb),
  type="mixed")
error <- errorsarlm(CRIME ~ HOVAL + INC, data=columbus, nb2listw(col.gal.nb))
LR.sarlm(mixed, error)
Hausman.test(error)

Example output

Loading required package: sp
Loading required package: Matrix

colmbs> require(maptools)
Loading required package: maptools
Checking rgeos availability: TRUE

colmbs> columbus <- readShapePoly(system.file("etc/shapes/columbus.shp",
colmbs+  package="spdep")[1])

colmbs> col.gal.nb <- read.gal(system.file("etc/weights/columbus.gal",
colmbs+  package="spdep")[1])
Warning message:
use rgdal::readOGR or sf::st_read 

	Likelihood ratio for spatial linear models

data:  
Likelihood ratio = 4.2782, df = 2, p-value = 0.1178
sample estimates:
Log likelihood of mixed Log likelihood of error 
              -182.0161               -184.1552 


	Spatial Hausman test (asymptotic)

data:  NULL
Hausman test = 6.4729, df = 3, p-value = 0.09074

spdep documentation built on Aug. 19, 2017, 3:01 a.m.