On Fri, 23 Jul 2010, elaine kuo wrote:
1. change method to Matrix
System calculation is specific, the condition is =5.14146e-17 (translated
from Chinese)
Warning messages:
Warning not a problem, but the error suggests scaling problems in the
covariance matrix of the coefficients. The X variables are most likely
measured in inappropriate metrics (some coefficients of size 1000, others of
size 0.0001, for example).
==> using standardized regression, the warning disappeared as you advised.
However, another set of warning appears:
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
Please kindly advise how to modify the code below from determinant L to
determinant A and why ?
The warning is irrelevant. The error is caused by your weights.
2. great distance circle
And make sure that you do use Great Circle distances - you are not doing so
now.
With 200 neighbours, you have no viable spatial process, really.
=> longlat = TRUE returns no valid observation ...
similar error messages have been researched in the archived mail
but no identical case found...
Please kindly suggest when longlat=TRUE,
whether the unit of both longitude and latitude is degree.decimal..
(confused with the manual explanation "measured in kilometer")
The threshold is in km when longlat=TRUE, but the coordinates are in
decimal degrees. Please state the representation of your coordinates - are
they in decimal degrees or not?
Also, does "no viable spatial process" mean
no spatial interaction within the range should be taken into
consideration ?
No, simply that you are including too many neighbours leading to too much
smoothing for many observations.
Please try everything on small examples until you understand what you are
doing. Best, use publically available small examples, and include complete
verbatim code (or post code on a website), max. 10 lines.
Thank you
Elaine
code
datam <-read.csv("c:/migration/M_R_SummerM20100722.csv",header=T,
row.names=1)
# std method scale
datam.sd<-scale(datam)
datam.std<-as.data.frame(datam.sd)
summary (datam.std)
mean(datam.std)
# obtain standard deviation
sd(datam.std)
mig.std
<-lm(datam.std$SummerM_ratio~datam.std$coast+datam.std$topo_mean+datam.std$prec_mean+datam.std$temp_ran+datam.std$evi_ran,data=datam.std)
summary(mig.std)
#SAR
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,longlat=TRUE)
#Spatial weights, illustrated with coding style "W" (row standardized)
nb5.w<-nb2listw(nb5, glist=NULL, style="W", zero.policy=TRUE)
+++error in nb2listw(nb5, glist = NULL, style = "W", zero.policy = TRUE)
:
No valid observations +++
(then modified as nb5<-dnearneigh(coords,0,5) and Matrix went on
smoothly )
# Spatial SAR error model
sem.nb5.w <-
errorsarlm(datam.std$SummerM_ratio~datam.std$coast+datam.std$topo_mean+datam.std$prec_mean+datam.std$temp_ran+datam.std$evi_ran,data=datam.std,
listw=nb5.w, na.action=na.omit, method="Matrix", zero.policy=TRUE)
+++warning
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 ++++
--
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.biv...@nhh.no
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo