Skip to content
Prev 11297 / 29559 Next

Spatial Lag and Error Model

-----Original Message-----
From: Janmaat, John 
Sent: Thursday, March 24, 2011 3:40 PM
To: 'Roger.Bivand at nhh.no'
Subject: RE: [R-sig-Geo] Spatial Lag and Error Model

Hello Roger,

Thanks for your reply.

A code snippet:

nl <- knearneigh(cbind(wd2$Long,wd2$Lat),k=4)
nb <- knn2nb(nl)
weightings <- nb2listw(nb)
wd.GMerrorsarSum <- gstsls(frmWin, data=wd2,weightings)

The error message:

Error in solve.default(QQ, Qye) : 
  system is computationally singular: reciprocal condition number =
4.20784e-28

There are 10,996 observations.

The dataset has been processed to remove any overlapping points (no zero
distances) and to remove points that do not have at least one neighbour
within 100m.  Overlapping points existed as accounts would change when a
resident moved, leading to multiple observations for a single lot.  This
is what I originally thought could be the issue, as there are then zero
distances.  It has also had all observations with NA removed.  The model
represented in frmWin is solved fine by lm(), with no variables dropped.

I'm not sure how to check for near linear dependence in WX though, so I
would appreciate it if you could direct me there.

I am using k nearest neighbours, as opposed to rook or queen as my data
has lat and long for the lot centroid, as opposed to a polygon for each
lot.

There are some natural boundaries within the data, such that it can be
divided into subsets where within each subset the neighbour list for the
observations in the subset is no different from that generated for the
whole dataset.  I have also done an analysis separately for such
subsets, with the same result.

Thanks in advance for any suggestions.

John.

-----Original Message-----
From: Roger Bivand [mailto:Roger.Bivand at nhh.no] 
Sent: Thursday, March 24, 2011 1:27 AM
To: Janmaat, John
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] Spatial Lag and Error Model
On Wed, 23 Mar 2011, Janmaat, John wrote:

            
neighbour
have
Well, what we are missing are the verbatim error messages and function 
calls. It may well be that your diagnosis of the problem is not precise 
enough, especially as the code used depends on your choice of input 
arguments. Does lm() of the same model report any unfitted coefficients 
(are there near-linear dependencies present in the X variables, or
between 
X and WX)?

Roger