# [R-sig-Geo] testing linear combinations of coefficients after spatial regression

Roger Bivand Roger.Bivand at nhh.no
Sun Jul 3 16:54:16 CEST 2011

```On Sat, 2 Jul 2011, Jason Sorens wrote:

> I'm interested in testing linear combinations of coefficients after models
> like spautolm, errorsarlm, and lagsarlm in the spdep package. I'm used to
> using "anova" for this, but the anova.sarlm implementation doesn't seem to
> permit it straightforwardly. For instance, if I wanted to testing something
> like b_1-.25*b_2=0, how would I go about doing that?

See the linearHypothesis() methods in the car package. I think that, after
someone has checked that all is as it should be, sarlm objects could get a
vcov() method, which they do not have now. These work formally, but are
not checked:

library(car)
library(spdep)
example(columbus)
lmobj <- lm(CRIME ~ HOVAL+INC, data=columbus)
linearHypothesis(lmobj, "HOVAL-INC=0", test="Chisq")
lagobj <- lagsarlm(CRIME ~ HOVAL+INC, data=columbus,
listw=nb2listw(col.gal.nb))
linearHypothesis(lagobj, "HOVAL-INC=0", test="Chisq",
vcov.=lagobj\$resvar[2:5,2:5])
errobj <- errorsarlm(CRIME ~ HOVAL+INC, data=columbus,
listw=nb2listw(col.gal.nb))
linearHypothesis(errobj, "HOVAL-INC=0", test="Chisq",
vcov.=errobj\$resvar[2:5,2:5])

Please do check that this is an appropriate use of the returned values
when fitted using eigenvalues. Other steps would be needed when a (mixed)
numerical Hessian is used to approximate the variance/covariance matrix of
the coefficients. Then a vcov() method could be added for sarlm objects,
but it needs caution and analysis.

Hope this helps,

Roger

>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

```