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!