Learn R Programming

spdep (version 0.6-15)

anova.sarlm: Comparison of simultaneous autoregressive models

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

# S3 method for sarlm
anova(object, ...)

Arguments

object

object is of class sarlm

other objects of class sarlm or class lm

Value

The function returns a data frame printed by default functions

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.

See Also

LR.sarlm, AIC

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab