[R-sig-Geo] R-sig-Geo Digest, Vol 150, Issue 14

Corey Sparks corey.sparks at utsa.edu
Mon Feb 15 16:13:12 CET 2016

Hi Maryia,
What function are you using to fit the models? If you're using the fitting routines in spdep, (lagsarlm, errorsarlm, sacsarlm, spautolm) then the AIC prints for each model using the summary() function. You can also get a pseudo R^2 using the summary(fit, Nagelkerke=T) option

for example:
COL.lag.eig <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
nb2listw(COL.nb, style="W"), method="eigen", quiet=FALSE)
summary(COL.lag.eig, Nagelkerke=T)

shows both the AIC and the pseudo R^2

Hope this helps

Corey Sparks, PhD
Associate Professor
Graduate Advisor of Record
Department of Demography
The University of Texas at San Antonio
501 West Cesar E Chavez Blvd
corey.sparks 'at' utsa.edu

On Feb 15, 2016, at 5:00 AM, r-sig-geo-request at r-project.org wrote:

Date: Sun, 14 Feb 2016 20:58:42 -0600
From: Maryia Bakhtsiyarava <bakht013 at umn.edu>
To: R-sig-geo Mailing List <r-sig-geo at r-project.org>
Subject: [R-sig-Geo] AIC/R^2 in splm
<CAKFowAiRdSkFHdAr3qp6zeH2_wvMXZNetwv+tjAGZRUX9CUEdg at mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Dear list members,

I am estimating a spatial lag model with time-period fixed effects using
package splm. I would like to obtain some goodness-of-fit measures for my
models but I cannot figure out how to do it. The traditional AIC extraction
function doesn't work for a an object of class "splm".

The only thing I can extract is the log likelihood, using which in theory I
can calculate AIC, but even in that case I am not sure about the degrees of
freedom to use in the calculation (do I count time dummies, lag and
intercept as parameters?). I tried df.residual(model) but I got NULL.

Is there another way to obtain AIC and/or R^2? I am sure people encountered
this problem before, so if you have any advice on how to obtain model
statistics, I would greatly appreciate it.

Thank you,
Maryia Bakhtsiyarava
Graduate student
Department of Geography, Environment and Society
University of Minnesota, Twin Cities

Research Assistant
TerraPop Project
Minnesota Population Center

414 Social Sciences, 267 19th Ave S, Minneapolis, MN 55455

[[alternative HTML version deleted]]


Message: 3
Date: Mon, 15 Feb 2016 09:33:44 +0100
From: Tobias R?ttenauer <ruettenauer at sowi.uni-kl.de>
To: <Roger.Bivand at nhh.no>
Cc: R-sig-Geo at r-project.org
Subject: Re: [R-sig-Geo] LM test for spatial dependence with panel
Message-ID: <001501d167cb$950379b0$bf0a6d10$@sowi.uni-kl.de>
Content-Type: text/plain; charset="iso-8859-1"

Dear Roger,

thanks for your answer!

Dear list members,

I'm currently estimating a fixed effects panel model and I want to
control for spatial dependence. Thus, I also estimated two spatial
fe-models, one with a spatial error term and one with a spatial error
term and spatial lag variable. Both lambda and rho are highly
significant and the independent variables of the models differ

However, I would like to control the model specifications with a
Lagrange Multiplier test. More precisely, I would like to test for
spatial lag dependence (while allowing possible spatial error
dependence) and for spatial error dependence (while allowing possible
spatial lag dependence) like described by Anselin/ Bera/ Florax/ Yoon
(1996), which is possible for cross-sectional data using lm.LMtests
(spdep). Is there a possibility to estimate a similar test for panel
data? If I'm not mistaking, the splm-implemented tests do not account
spatial lag dependence?

You may be able to test the pooled model only using lm() on the data and
taking a Kronecker product of your spatial weights by a time-dimensioned
identity matrix, and using the function for cross-sectional models, but I
that this is not what you want.

I mean, one could argue that a cross-sectional spatial dependence also leads
to spatially correlated variations over time, but this is not necessarily
the case. So you are right, it would be the best to implement an appropriate
test (if feasible).

You'd need to identify an appropriate test in
the literature, and see whether it can be implemented (and whether then it
actually works). In many cases, significant lag and error processes
are related to missing variables, and to spatial processes not matching
spatial units - aggregates - you are using.

You mean the error-correlation is a result of one or more omitted variables
that operate independently from the spatial relationship I modeled in the
spatial weights matrix? Then, it may be an idea to compare different
distance/neighborhood measures? Or do you mean it is a problem of the
aggregates itself (like too large spatial units)?

Thanks again,

Hope this helps,


Thank you very much in advance for your help!


R-sig-Geo mailing list
R-sig-Geo at r-project.org

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


Subject: Digest Footer

R-sig-Geo mailing list
R-sig-Geo at r-project.org


End of R-sig-Geo Digest, Vol 150, Issue 14

	[[alternative HTML version deleted]]

More information about the R-sig-Geo mailing list