Hello,

Thanks for the always concerns.
answering the previous questions first.


>> 1. distance threshold
>>
>
> But 9 what, metres, degrees? Should your code be:
> cbind(datam$lat,datam$lon), as the normal ordering is eastings then
> northings, not the opposite?


 =>   unit is degree, and the lat/lon is revised (thanks)

>
>
>
>>
>> 9 is the cutting point for avoiding empty neighbour sets
>>
>
> This is not a good reason, as graph neighbours can be sparse and link over
> longer distances.
>
>
 =>   according to previous message with similar questions,
        it is mentioned that including empty neighbor sets could be
meaningless...
        so, if empty neighbor sets are accepted here,
        could there be anything needed to be cautious upon ?

>
>
>> 2. dataset
>> length(nb10)=4873.
>> sum(card(nb10)=885478)
>>
>>
> This gives an average of 181.7 neighbours per observation, and is the root
> of the problem. The Chebyshev method uses a set of low powers of the
> weights, which fill in quickly for large average numbers of neighbours. Did
> you try the Matrix method (your error message suggests that you may have
> done, but the code does not)?
>
> =>  "Matrix" tried but failed. The warning and code as below..


1. change method to Matrix

Error in solve.default(-(mat), tol.solve = tol.solve) :

  System calculation is specific, the condition is =5.14146e-17 (translated
from Chinese)

Warning messages:

1: In determinant(x, TRUE) : This version of the Matrix package returns

|determinant(L)| instead of determinant(A), i.e., a

*DIFFERENT* value.

 If still necessary, do change your code, following
http://matrix.r-forge.r-project.org



2: In powerWeights(W = W, rho = lambda, order = con$pWOrder, X = B,  :

  not converged within order iterations

3: In powerWeights(W = t(W), rho = lambda, order = con$pWOrder, X = C,  :

  not converged within order iterations





code



rm(list=ls())

datam <-read.csv("c:/migration/M_R_2090707_winterM.csv",header=T,
row.names=1)

dim(datam)

datam[1,]



library(ncf)

library(spdep)



# Define coordinates, neighbours, and spatial weights

coords<-cbind(datam$lon,datam$lat)

coords<-as.matrix(coords)



#Define neighbourhood (here distance 9)

nb9<-dnearneigh(coords,0,9)



length(nb9)

sum(card(nb9))



#Spatial weights, illustrated with coding style "W" (row standardized)

nb9.w<-nb2listw(nb9, glist=NULL, style="W", zero.policy=FALSE)



# Spatial SAR error model

sem.nb9.w <-
errorsarlm(datam$WinterM_ratio~datam$topo_mean+datam$coast+datam$prec_max
+datam$temp_min+datam$evi_min, data=datam, listw=nb9.w, na.action=na.omit,
method="Matrix", zero.policy=TRUE,,tol.solve=1.0e-17)



>
>  3. memory size
>> the memory limit is 1535 Mb, which is much larger than 121.8 Mb.
>>
>>
> Windows (your OS?) memory handling is very poor for larger objects, and the
> 121Mb is extra memory needed.



=>  OS : Vista HOME



> However, the main problem is your design of weights, which are far too
> dense to make sense. Choose an alternative weights definition and try again.
>

=> 2.  decrease the neighbor distance from 9 to 5

Warning messages:

1: In powerWeights(W = W, rho = lambda, order = con$pWOrder, X = B,  :

  not converged within order iterations

2: In powerWeights(W = t(W), rho = lambda, order = con$pWOrder, X = C,  :

  not converged within order iterations







code

rm(list=ls())

datam <-read.csv("c:/migration/M_R_20100707_winterM.csv",header=T,
row.names=1)

dim(datam)

datam[1,]



library(ncf)

library(spdep)



# Define coordinates, neighbours, and spatial weights

coords<-cbind(datam$lon,datam$lat)

coords<-as.matrix(coords)



#Define neighbourhood (here distance 5)

nb5<-dnearneigh(coords,0,5)



#Spatial weights, illustrated with coding style "W" (row standardized)

nb5.w<-nb2listw(nb5, glist=NULL, style="W", zero.policy=TRUE)





# Spatial SAR error model
sem.nb5.w <-
errorsarlm(datam$WinterM_ratio~datam$topo_mean+datam$coast+datam$prec_max
+datam$temp_min+datam$evi_min, data=datam, listw=nb5.w, na.action=na.omit,
method="Chebyshev", zero.policy=TRUE,,tol.solve=1.0e-17)

Elaine

	[[alternative HTML version deleted]]

