Skip to content
Back to formatted view

Raw Message

Message-ID: <alpine.LFD.2.21.1905171409250.7805@reclus.nhh.no>
Date: 2019-05-17T12:13:08Z
From: Roger Bivand
Subject: Question spdep package - extending nb object
In-Reply-To: <401C126D-5669-4E97-ADA8-9879B42835E3@yahoo.de>

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 at 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 at nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en