[R] unable to run spatial lag and error models on large data

Roger Bivand Roger.Bivand at nhh.no
Wed Jul 25 22:19:55 CEST 2012

shish matt <shishm <at> yahoo.com> writes:

> Hi:
> First my apologies for cross-posting. A few days back I posted my queries ar
R-sig-geo but did not get any
> response. Hence this post.

Since your message never reached that list - did you check? - that isn't very
surprising. Try again properly on R-sig-geo.

> I am working on two parcel-level housing dataset to estimate the impact of
various variables on home sale
> prices. 
> I created the spatial weight metrics in ArcGIS 10 using sale 
> year of four nearest houses to assign weights.  

Create them in R, much less error prone. knn2nb(knearneigh()). A lot of problems
arise from badly imported weights, but yours below seem OK.

> Next, I ran LM tests and
>  then ran the spatial lag and error models using spdep package. 
> I run into five issues. 
> Issue 1: When I weight the 10,000-observation first dataset, I get the
following message: Non-symmetric
> neighbors list.   
> Is this going to pose problems while running the regression models? If yes,
what can I do? 

What do you think? If you are using nearest neighbours, only a very unusual set
of points would give symmetric neighbours, and that would likely also have
subgraph problems.

> Issue 2: The spatial lag and error models do not run. I get 
> the following message (the models runs on half the data, approx. 5,000 
>  observations.  However, I will like to use the entire sample).   

Read the help pages, method= argument. For larger data sets, use "LU" or perhaps
"MC" when the weights are not symmetric.

> Error: cannot allocate vector of size 880.0 Mb 
> When I am able to read the data file using filehash package. 
>  However, I still get the following error message when I run the models:
>  Error in matrix(0, nrow = n, ncol = n) : too many elements specified 

No idea, almost certainly caused by not reading the documentation. Try on the
original list.

> 	[[alternative HTML version deleted]]

DO follow the rule of not posting HTML!

More information about the R-help mailing list