[R-sig-Geo] "spdep": check whether a spatial model fully controls for spatial correlation
Gary Dong
donghw79 @end|ng |rom hotm@||@com
Sun Mar 22 18:59:19 CET 2020
Thank you, Roger.
I ran Hausman.test() for both my spatial error model (p-value < 2.2e-16) and my spatial Durbin error model (p-value = 3.693e-11). My understanding of these two tests is that my SDEM performs better than my SEM, but there is still room for better specification of my SDEM. Is my understanding correct?
I know that the function "impacts()" applies to spatial lag models only. Is there a R function or a formula that I can use to compute the total impacts based on the X and lag.X coefficients in a SDEM?
Best
Gary
________________________________
From: Roger Bivand <Roger.Bivand using nhh.no>
Sent: Sunday, March 22, 2020 9:06 AM
To: Gary Dong <donghw79 using hotmail.com>
Cc: r-sig-geo using r-project.org <r-sig-geo using r-project.org>
Subject: Re: [R-sig-Geo] "spdep": check whether a spatial model fully controls for spatial correlation
On Sun, 22 Mar 2020, Gary Dong wrote:
> Dear Roger, thank you very much for your advice.
>
> I ran Lagrange tests. The tests yielded very small p-values for both
> spatial lag and error models. Both RLMerr and RLMlag are all very
> significant (with very small p-values) and the p-value of RLMerr is even
> smaller. So I went with the spatial Durbin error model (SDEM). The
> regular spatial Durbin model (SDM) did not work (it produced many NAs in
> the estimates).
Not those LM tests. At the foot of the output of the
summary method for spatialreg::lagsarlm, you see the output of the LM test
for residual autocorrelation in a spatial lag model.
>
> Because it is unclear how exactly my observations relate to each, I
> decide to test is out. I construct spatial weight matrices with
> different number of neighbors (k=10, 20, 50, &100). I run a SDEM with
> each spatial weight matrix and compare their AICs and log likelihoods.
> Oddly, SDEMs with smaller spatial weight matrix performed better
> (smaller AIC and higher log likelihood). This seems to suggest that in
> my case, the model works better when it considers a smaller number of
> neighboring observations. I also observe that SDEMs with larger weight
> matrices (e.g. k=50 or 100) tend to yield larger indirect effects
> (larger coefficients of lag.Xs). In some cases, the indirect effects are
> unreasonably large. This seems to confirm that with my data, SDEMs with
> smaller weight matrices perform better.
>
Usually, it is much better to use a simple graph between proximate
neighbours. k-nearest neighbours appear asymmetric, but a SAR model makes
them symmetric anyway. And the spatial process itself is dense (the
variance-covariance matrix of observations). Having denser weights may
well over-smooth as you see.
> Is this somewhat counter-intuitive, given that the Moran's I test
> suggests very strong spatial auto-correlation in my data? Does this mean
> that I should go with the SDEM with k=10, or even decrease K number
> below 10?
Certainly reduce further, a graph-based measure will typically have about
6 neighbours. LeSage & Pace have found that the choice of weights isn't so
important, and any weights (even sparse) will do better than ignoring the
spatial autocorrelation. Tony Smith has found that too dense weights may
bias the fitted model.
Go with small k and SDEM, if the Hausman test doesn't indicate other
misspecification. And use the impacts method to aggregate the X and WX
contributions.
Hope this clarifies,
Roger
>
> Best
> Gary
>
>
> ________________________________
> From: Roger Bivand <Roger.Bivand using nhh.no>
> Sent: Saturday, March 21, 2020 3:07 AM
> To: Gary Dong <donghw79 using hotmail.com>
> Cc: r-sig-geo using r-project.org <r-sig-geo using r-project.org>
> Subject: Re: [R-sig-Geo] "spdep": check whether a spatial model fully controls for spatial correlation
>
> On Sat, 21 Mar 2020, Gary Dong wrote:
>
>> Dear all,
>>
>> I have estimated a spatial error model via the "spdep" package. The
>> spatial weights are determined based on the inverse distance between an
>> observation and its 50 nearest neighbors (knearneigh, k=50). Now I
>> wonder if my spatial error model has FULLY controlled for spatial
>> autocorrelation in the data. Is there a way to test it? I know I can use
>> lm.morantest() to test spatial autocorrelation in residuals from an
>> estimated OLS model. But I do not know if there is a similar test for a
>> spatial error model. Any advice is greatly appreciated.
>
> You will know that there is a Lagrange Multiplier test for spatial lag
> model residuals. There is however no test for the residuals of a spatial
> error model. IDW will not help either - the choice of W as a fixed graph
> stipulates that you definitely know that it is the way observations relate
> to each other. Even PCNM/MESF (spatial filtering with the eigenvectors of
> a centred weights matrix) still assumes that the weights matrix is known.
>
> For spatial error models, you should always report the Hausman test.
> You can only accept that SEM is not misspecified if it confirms that the
> SEM and OLS coefficients are close. Unobserved covariates are a typical
> cause of trouble; adding WX (the SDEM, D for Durbin) may help. But if your
> phenomena exhibit different scaling in the footprints of their spatial
> processes, testing (if a test existed) with the same W wouldn't expose the
> problem.
>
> Probably SLX and SDEM are worth exploring, and for SEM and SDEM, reporting
> the Hausman test.
>
> There is a literature starting to appear on adaptive spatial weights, some
> functionality is in CARBayes.
>
> Hope this helps,
>
> Roger
>
>>
>> Best
>> Gary
>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
> https://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list