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

Roger Bivand Roger@B|v@nd @end|ng |rom nhh@no
Fri May 17 14:13:08 CEST 2019


On Thu, 16 May 2019, Raphael Mesaric via R-sig-Geo wrote:

> 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.

Not even worth trying, as you found. Do you mean a Kronecker product, as 
found in spatial panel models? Or do you mean that you have blocks of 
observations without position that belong to upper-level objects with 
known position (postcodes or similar)? If the latter, look at 
?spdep::nb2blocknb.

Hope this clarifies,

Roger

>
> Can you help me with this issue? Any suggestions are highly appreciated.
>
> Thank you in advance.
>
> Best regards,
>
> Raphael Mesaric
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en



More information about the R-sig-Geo mailing list