Description Usage Arguments Details Value Author(s) See Also Examples
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.
1 2  | 
object | 
 
  | 
... | 
 other objects of class   | 
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.
The function returns a data frame printed by default functions
Roger Bivand Roger.Bivand@nhh.no
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)
 | 
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.