[R-sig-Geo] Question spdep package - extending nb object

Raphael Mesaric r@ph@e|@me@| @end|ng |rom y@hoo@de
Thu May 16 21:01:09 CEST 2019


Dear all,

I am working on a spatial regression model which is built in such a way that the dependent variable consists of n blocks of multiple entries, and each block is referring to the same spatial grid. In order to run the lagsarlm() function or the errsarlm() function, I now need to extend my initial nb object from one grid to n grids. In other words, I need the nb object to be repeated n times. However, so far I did not find a way to do this properly.

I tried to just replicate the nb object by repeating the entries of the neighbours list and the weights list, respectively.

dnn800_3w$neighbours <- rep(dnn800_3w$neighbours,20)
dnn800_3w$weights <- rep(dnn800_3w$weights,20)

When I do this, I get the following error message:

Error in is.symmetric.nb(listw$neighbours, FALSE) : Not neighbours list

Which makes sense, as the matrix is not symmetric any more due to the steps described above. However, I cannot think of a correct implementation at the moment.

Can you help me with this issue? Any suggestions are highly appreciated.

Thank you in advance.

Best regards,

Raphael Mesaric
	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list