[R-sig-Geo] error in errorsarlm

Roger Bivand Roger.Bivand at nhh.no
Fri Jul 16 21:52:02 CEST 2010


On Fri, 16 Jul 2010, elaine kuo wrote:

> Dear List,
>
> I encountered an error message when trying to use Chebyshev as method for
> SAR.
> Please kindly help and thanks.

Beyond what Danlin said, I am very unsure where to start. Please provide 
adequate information about your input data, specifically the number of 
observations, and the number of links in the neighbour list

length(nb10)
sum(card(nb10))

In addition, the implicit discription of nb10 looks confusing (is the 
distance threshold 1.5, 9, or 10?). The ordering of lat and lon looks 
wrong. You are not using Great Circle distances (and probably should?). So 
memory issues in errorsarlm are the least of your problems. My guess is 
that with dnearneigh() and a threshold of 9 degrees, you are including 
most of a large data set in the neighbour list, and if n is large, this 
will give a very large almost dense set of spatial weights, which was not 
what you intended.

Get the weights correct first, and the rest will likely follow.

Roger


>
> package spdep was updated on 07162010
> system: windows vista home 32-bit
> R version 2.10.0 (20091026)
>
> Elaine
>
> Code
>> library(ncf)
>> library(spdep)
>>
>> # Define coordinates, neighbours, and spatial weights
>> coords<-cbind(datam$lat,datam$lon)
>> coords<-as.matrix(coords)
>>
>> #Define neighbourhood (here distance 1.5)
>> nb10<-dnearneigh(coords,0,9)
>> nb10.w<-nb2listw(nb10, glist=NULL, style="W", zero.policy=FALSE)
>> sem.nb10.w <-
> errorsarlm(datam$WinterM_ratio~datam$topo_mean+datam$coast+datam$prec_max
> +datam$temp_min+datam$evi_min, listw=nb10.w,
> method="Chebyshev",tol.solve=1.0e-17)
> error: cannot allocate vector of size 121.8 Mb
>
>> sem.nb10.w <-
> errorsarlm(datam$WinterM_ratio~datam$topo_mean+datam$coast+datam$prec_max
> +datam$temp_min+datam$evi_min, listw=nb10.w,
> method="Chebyshev",zero.policy=TRUE,tol.solve=1.0e-17)
> error in switch(Generic, `+` = , `-` = { :
>  Cholmod error 'out of memory' at file:../Core/cholmod_memory.c, line 148
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list