1

I am attempting to run a spatial autoregressive model (general form here):

SAR1=lagsarlm(log(dependentvariable)~X1+X2+X3, data=DATANAME, listw=SW, na.omit, type="lag", method="eigen",quiet=NULL,interval=NULL,tol.solve=1.0e-10,trs=NULL)

where SW is a row-standardized spatial weights matrix that was previously transformed into a .listw object.

I receive the following error:

Error in subset.listw(listw, subset, zero.policy = zero.policy) : 
  Not yet able to subset general weights lists

When I try to use subset(SW), I receive the following error:

> subset(SW)
Error in is.logical(subset) : 'subset' is missing

Does anyone have any speedy tips for me? For some background, I can explain how my weights matrix was formed, since it wasn't with one of the normal canned packages. I will provide an abridged summary here. I wished to define neighbors as entities residing in neighborhoods A, B, and C. I manually created an nxn matrix of 1's for neighbors and 0's for non-neighbors, and included 0's in the diagonals.

I then used the R function mat2listw() to turn it into a row-standardized .listw object, with no errors. This is what is called 'SW' in my above code.

Can someone explain to me what exactly subsetting means in this context and how it might be best done in my problem? It seems that I need to define my subsets somehow, and that may be what is missing. Is this the case, how can I efficiently do so to preserve my defined neighbors accordingly? If this is not my problem, does anyone have thoughts on what the issue is?

I am working under a super tight deadline, so any and all tips would be greatly appreciated! Thank you!

Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73
user3050574
  • 23
  • 1
  • 5
  • You should state that you're using `spdep` . Meanwhile, possible info at http://stackoverflow.com/questions/20292761/using-mat2listw-function-in-r-to-create-spatial-weights-matrix – Carl Witthoft Dec 10 '13 at 18:53
  • Thanks, Carl. You're right, I should have mentioned that. In the meantime, the post that you directed me to is actually one of my old posts. I had figured out my issues there, and as described above, created my listw object appropriately with 0 na's. So, my question now is in regards to subsetting - how can it be done in my context? – user3050574 Dec 10 '13 at 20:26

0 Answers0