Likelihood ratio test
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
.
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 'Sarlm' anova(object, ...) bptest.Sarlm(object, varformula=NULL, studentize = TRUE, data=list()) ## S3 method for class 'Sarlm' impacts(obj, ..., tr, R = NULL, listw = NULL, evalues=NULL, useHESS = NULL, tol = 1e-06, empirical = FALSE, Q=NULL)
x |
a |
y |
a |
object, obj |
a |
... |
further arguments passed to or from other methods |
varformula |
a formula describing only the potential explanatory variables for the variance (no dependent variable needed). By default the same explanatory variables are taken as in the main regression model |
studentize |
logical. If set to |
data |
an optional data frame containing the variables in the varformula |
tr |
A vector of traces of powers of the spatial weights matrix created using |
listw |
If |
evalues |
vector of eigenvalues of spatial weights matrix for impacts calculations |
R |
If given, simulations are used to compute distributions for the impact measures, returned as |
useHESS |
Use the Hessian approximation (if available) even if the asymptotic coefficient covariance matrix is available; used for comparing methods |
tol |
Argument passed to |
empirical |
Argument passed to |
Q |
default NULL, else an integer number of cumulative power series impacts to calculate if |
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
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).
Roger Bivand Roger.Bivand@nhh.no, bptest
: Torsten Hothorn and Achim Zeileis, modified by Roger Bivand
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. T.S. Breusch & A.R. Pagan (1979), A Simple Test for Heteroscedasticity and Random Coefficient Variation. Econometrica 47, 1287–1294
W. Krämer & H. Sonnberger (1986), The Linear Regression Model under Test. Heidelberg: Physica.
L. Anselin (1988) Spatial econometrics: methods and models. Dordrecht: Kluwer, pp. 121–122.
require("sf", quietly=TRUE) columbus <- st_read(system.file("shapes/columbus.shp", package="spData")[1], quiet=TRUE) #require("spdep", quietly=TRUE) col.gal.nb <- spdep::read.gal(system.file("weights/columbus.gal", package="spData")[1]) lm.mod <- lm(CRIME ~ HOVAL + INC, data=columbus) lag <- lagsarlm(CRIME ~ HOVAL + INC, data=columbus, spdep::nb2listw(col.gal.nb)) mixed <- lagsarlm(CRIME ~ HOVAL + INC, data=columbus, spdep::nb2listw(col.gal.nb), type="mixed") error <- errorsarlm(CRIME ~ HOVAL + INC, data=columbus, spdep::nb2listw(col.gal.nb)) Hausman.test(error) LR.Sarlm(mixed, error) anova(lag, lm.mod) anova(lag, error, mixed) AIC(lag, error, mixed) bptest.Sarlm(error) bptest.Sarlm(error, studentize=FALSE) ## Not run: lm.target <- lm(error$tary ~ error$tarX - 1) if (require(lmtest, quietly=TRUE) && require(sandwich, quietly=TRUE)) { print(coeftest(lm.target, vcov=vcovHC(lm.target, type="HC0"), df=Inf)) } ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.