[R] Why I get the massage of "Error in impacts.sarlm(s.lag, mat2listw(swmmat)) : Only row-standardised weights supported"

wenyueyang yangwenyue900780 at 163.com
Sun Jul 26 07:43:03 CEST 2015


Hi,all

I am using the spdep-package to estimate the SAR(or called SLM) and SDM in
R. I can get the estimation results of SAR and SDM with the command of
"lagsarlm". But when I perform the "impact" command to calculate the direct
effect, indirect effect and total effect, it feedback the following
sentences:"Error in impacts.sarlm(s.lag, mat2listw(swmmat)) : Only
row-standardised weights supported".
I used the same matrix, whcih I built in ArcGIS 10.1 based on the principle
of "inversed distance" with row standarised, and then it was converted into
R.
I have tried many times. Can you tell me what else I need to do to calculate
the impacts and tell me the codes. Thank you so much!

Best regards. 

Yours sincerely, 
Wenyue Yang

*The codes I put into R is presented as follow:*

>v=read.csv(file=file.choose(),header=T)
>library(spdep)
>swm<-read.table(file=file.choose(),header=T,sep=",")# I choose the text
file of matrix built in ArcGIS
>n=length(unique(swm[[3]]))
>swmmat<-matrix(0,n,n)
>apply(swm,1,function(x)swmmat[x[3],x[4]]<<-x[5])
>setequal(swm$ID, v$ID)
>dimnames(swmmat)<-list(v$ID,v$ID)
>swmmat<-swmmat[v$ID,v$ID]
>fm=SJgap~BSD+MSD+RND
>s.lag<-lagsarlm(fm,data=v,listw=mat2listw(swmmat))
>impacts(s.lag, mat2listw(swmmat))
Error in impacts.sarlm(s.lag, mat2listw(swmmat)) : 
  Only row-standardised weights supported

OR
> W <- as(mat2listw(swmmat), "CsparseMatrix")
> trMatc <- trW(W, type="mult")
> impacts(s.lag, trMatc)
Error in impacts.sarlm(s.lag, trMatc) : 
  Only row-standardised weights supported




--
View this message in context: http://r.789695.n4.nabble.com/Why-I-get-the-massage-of-Error-in-impacts-sarlm-s-lag-mat2listw-swmmat-Only-row-standardised-weights-tp4710356.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list