anova.sarlm: Comparison of simultaneous autoregressive models

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/anova.sarlm.R

Description

One of a number of tools for comparing simultaneous autoregressive models, in particular nested models. The function is based on anova.lme() for comparing linear mixed models, and follows that function in using the "anova" generic name.

Usage

1
2
## S3 method for class 'sarlm'
anova(object, ...)

Arguments

object

object is of class sarlm

...

other objects of class sarlm or class lm

Details

If successive models have different numbers of degrees of freedom, a likelihood ratio test will be performed between them. It is important to recall that tests apply to nested models, and this function at least attempts to make sure that the response variable in the models being compared has the same name. Useless results can still be generated when incomparable models are compared, it being the responsibility of the user to check.

Value

The function returns a data frame printed by default functions

Author(s)

Roger Bivand Roger.Bivand@nhh.no

See Also

LR.sarlm, AIC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
example(columbus)
lm.mod <- lm(CRIME ~ HOVAL + INC, data=columbus)
lag <- lagsarlm(CRIME ~ HOVAL + INC, data=columbus, nb2listw(col.gal.nb))
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)
anova(lag, lm.mod)
anova(lag, error, mixed)
AIC(lag, error, mixed)

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 

       Model df    AIC  logLik Test L.Ratio   p-value
lag        1  5 376.34 -183.17    1                  
lm.mod     2  4 382.75 -187.38    2  8.4179 0.0037154
      Model df    AIC  logLik Test L.Ratio p-value
lag       1  5 376.34 -183.17    1                
error     2  5 378.31 -184.16    1                
mixed     3  7 378.03 -182.02    2  4.2782 0.11776
      df      AIC
lag    5 376.3366
error  5 378.3104
mixed  7 378.0322

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