How to test spatial dependence in errorsarlm

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to test spatial dependence in errorsarlm

Javier García

Hello everybody:

 

I have estimated a spatial error model and now I would like to test whether that model has really “deleted” the spatial dependence. For the spatial lag model and for the Durbin model the function lagsarlm gives the LM test for residual autocorrelation test value, but the function errorsarlm does not. Does anyone know how to do it in R?

 

Thanks a lot in advance.

 

Javi

 

JAVIER GARCÍA

 

Departamento de Economía Aplicada III (Econometría y Estadística)

Facultad de Economía y Empresa (Sección Sarriko)
Avda. Lehendakari Aguirre 83

48015 BILBAO
T.: +34 601 7126 F.: +34 601 3754
www.ehu.es

http://www.unibertsitate-hedakuntza.ehu.es/p268-content/es/contenidos/informacion/manual_id_corp/es_manual/images/firma_email_upv_euskampus_bilingue.gif

 

 


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: How to test spatial dependence in errorsarlm

Roger Bivand
Administrator
On Sun, 13 Aug 2017, Javier García wrote:

> Hello everybody:
>
>
>
> I have estimated a spatial error model and now I would like to test whether
> that model has really ?deleted? the spatial dependence. For the spatial lag
> model and for the Durbin model the function lagsarlm gives the LM test for
> residual autocorrelation test value, but the function errorsarlm does not.
> Does anyone know how to do it in R?
>
As you should be aware from the literature, the only LM test that has been
written (the maths) is a test for residual error autocorrelation for
spatial lag models. Doing it in R will not help until someone (you?) does
the maths. Computing a value is easy, but knowing what to infer from it is
hard. By definition, if your model is well-specified, the residual
autocorrelation is fully captured by its coefficient. I suspect that your
model suffers from mis-specification problems.

Roger

>
>
> Thanks a lot in advance.
>
>
>
> Javi
>
>
>
>
>
>
> JAVIER GARCÍA
>
>
>
> Departamento de Economía Aplicada III (Econometría y Estadística)
>
> Facultad de Economía y Empresa (Sección Sarriko)
> Avda. Lehendakari Aguirre 83
>
> 48015 BILBAO
> T.: +34 601 7126 F.: +34 601 3754
> <http://www.ehu.es/> www.ehu.es
>
> http://www.unibertsitate-hedakuntza.ehu.es/p268-content/es/contenidos/inform
> acion/manual_id_corp/es_manual/images/firma_email_upv_euskampus_bilingue.gif
>
>
>
>
>
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: How to test spatial dependence in errorsarlm

Javier García
So testing for spatial dependence on the residuals by means of the
lm.LMtests (option LMerr, the only that works with residuals) is wrong,
isn't it? I had read in some forum that this was a posible way to test it...

In my case the Moran test and the LM tests (both LMerr and LMlag, and also
their robust versions) are strongly rejected (p-values between 4.307e-06
and 2.2e-16). As the rejection is stronger for the spatial error model, my
suspicion was that this could be the best model to capture the spatial
dependence (in fact the log-likelihood is bigger for the spatial error
model, and the AIC lower). However, how can I know whether the spatial error
model is a good option if I cannot test the absence of spatial dependence in
the residuals? And how can I know, as you suspect, whether I have a
misspecification problem? Moreover, I also estimated the Durbin model, and
in this case the LM test on the residuals suggests no spatial dependence
(for the spatial lag model I get the opposite conclusion), but due to the
nature of my regression I don't think that this model is suitable (the
regressors are characteristics of houses such as size, number of rooms,
etc).

Thanks a lot for your time.
Best
Javi    

-----Mensaje original-----
De: Roger Bivand [mailto:[hidden email]]
Enviado el: domingo, 13 de agosto de 2017 12:45
Para: Javier García
CC: [hidden email]
Asunto: Re: [R-sig-Geo] How to test spatial dependence in errorsarlm

On Sun, 13 Aug 2017, Javier García wrote:

> Hello everybody:
>
>
>
> I have estimated a spatial error model and now I would like to test
> whether that model has really ?deleted? the spatial dependence. For
> the spatial lag model and for the Durbin model the function lagsarlm
> gives the LM test for residual autocorrelation test value, but the
function errorsarlm does not.
> Does anyone know how to do it in R?
>

As you should be aware from the literature, the only LM test that has been
written (the maths) is a test for residual error autocorrelation for spatial
lag models. Doing it in R will not help until someone (you?) does the maths.
Computing a value is easy, but knowing what to infer from it is hard. By
definition, if your model is well-specified, the residual autocorrelation is
fully captured by its coefficient. I suspect that your model suffers from
mis-specification problems.

Roger

>
>
> Thanks a lot in advance.
>
>
>
> Javi
>
>
>
>
>
>
> JAVIER GARCÍA
>
>
>
> Departamento de Economía Aplicada III (Econometría y Estadística)
>
> Facultad de Economía y Empresa (Sección Sarriko)
> Avda. Lehendakari Aguirre 83
>
> 48015 BILBAO
> T.: +34 601 7126 F.: +34 601 3754
> <http://www.ehu.es/> www.ehu.es
>
>
http://www.unibertsitate-hedakuntza.ehu.es/p268-content/es/contenidos/inform
>
acion/manual_id_corp/es_manual/images/firma_email_upv_euskampus_bilingue.gif
>
>
>
>
>
>

--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: How to test spatial dependence in errorsarlm

Roger Bivand
Administrator
On Mon, 14 Aug 2017, Javier García wrote:

> So testing for spatial dependence on the residuals by means of the
> lm.LMtests (option LMerr, the only that works with residuals) is wrong,
> isn't it? I had read in some forum that this was a posible way to test it...

There was some speculation that these tests might be used on an lm fit of
the (I - \lambda W) y ~ (I - \lambda W) X model. These speculations have
never been checked rigorously, so nobody knows whether they are of any
value, probably not, and certainly we know nothing of their inferential
basis.

>
> In my case the Moran test and the LM tests (both LMerr and LMlag, and
> also their robust versions) are strongly rejected (p-values between
> 4.307e-06 and 2.2e-16). As the rejection is stronger for the spatial
> error model, my suspicion was that this could be the best model to
> capture the spatial dependence (in fact the log-likelihood is bigger for
> the spatial error model, and the AIC lower). However, how can I know
> whether the spatial error model is a good option if I cannot test the
> absence of spatial dependence in the residuals?

You by definition fix X and W as known, exogeneous, quantities. If X (and
functional forms) and/or W do not meet these requirements, there is little
good guidance. It depends on what you want: predict house prices where
they are not observed; estimate \beta values; estimate the impact of a
unit change in an X variable on house prices (y); whatever. A best-fit
model suggests that you want to predict, but isn't necessary for impacts
or betas if you trust X (and its functional forms) and W.

> And how can I know, as you suspect, whether I have a
> misspecification problem?

See a good deal of work by Daniel McMillen on these issues.

> Moreover, I also estimated the Durbin model, and in this case the LM
> test on the residuals suggests no spatial dependence (for the spatial
> lag model I get the opposite conclusion), but due to the nature of my
> regression I don't think that this model is suitable (the regressors are
> characteristics of houses such as size, number of rooms, etc).

This suggests that SLX or SDEM (see LeSage 2014 and SLX articles for a
discussion) may address many of the issues of spatial autocorrelation by
including (selected) WX. The Durbin versions of spdep functions do not
(yet) let you choose which WX to include, always including all X - this is
on my medium-term to-do list.

Roger

>
> Thanks a lot for your time.
> Best
> Javi
>
> -----Mensaje original-----
> De: Roger Bivand [mailto:[hidden email]]
> Enviado el: domingo, 13 de agosto de 2017 12:45
> Para: Javier García
> CC: [hidden email]
> Asunto: Re: [R-sig-Geo] How to test spatial dependence in errorsarlm
>
> On Sun, 13 Aug 2017, Javier García wrote:
>
>> Hello everybody:
>>
>>
>>
>> I have estimated a spatial error model and now I would like to test
>> whether that model has really ?deleted? the spatial dependence. For
>> the spatial lag model and for the Durbin model the function lagsarlm
>> gives the LM test for residual autocorrelation test value, but the
> function errorsarlm does not.
>> Does anyone know how to do it in R?
>>
>
> As you should be aware from the literature, the only LM test that has been
> written (the maths) is a test for residual error autocorrelation for spatial
> lag models. Doing it in R will not help until someone (you?) does the maths.
> Computing a value is easy, but knowing what to infer from it is hard. By
> definition, if your model is well-specified, the residual autocorrelation is
> fully captured by its coefficient. I suspect that your model suffers from
> mis-specification problems.
>
> Roger
>
>>
>>
>> Thanks a lot in advance.
>>
>>
>>
>> Javi
>>
>>
>>
>>
>>
>>
>> JAVIER GARCÍA
>>
>>
>>
>> Departamento de Economía Aplicada III (Econometría y Estadística)
>>
>> Facultad de Economía y Empresa (Sección Sarriko)
>> Avda. Lehendakari Aguirre 83
>>
>> 48015 BILBAO
>> T.: +34 601 7126 F.: +34 601 3754
>> <http://www.ehu.es/> www.ehu.es
>>
>>
> http://www.unibertsitate-hedakuntza.ehu.es/p268-content/es/contenidos/inform
>>
> acion/manual_id_corp/es_manual/images/firma_email_upv_euskampus_bilingue.gif
>>
>>
>>
>>
>>
>>
>
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway