Since the **spdep** package was created, *spatial weights* objects have been constructed as lists with three components and a few attributes, in old-style class `listw`

objects. The first component of a `listw`

object is an `nb`

object, a list of `n`

integer vectors, with at least a character vector `region.id`

attribute with `n`

unique values (like the `row.names`

of a `data.frame`

object); `n`

is the number of spatial entities. Component `i`

of this list contains the integer identifiers of the neighbours of `i`

as a sorted vector with no duplication and values in `1:n`

; if `i`

has no neighbours, the component is a vector of length `1`

with value `0L`

. The `nb`

object may contain an attribute indicating whether it is symmetric or not, that is whether `i`

is a neighbour of `j`

implies that `j`

is a neighbour of `i`

. Some neighbour definitions are symmetric by construction, such as contiguities or distance thresholds, others are asymmetric, such as `k`

-nearest neighbours. The `nb`

object redundantly stores both `i`

-`j`

and `j`

-`i`

links.

The second component of a `listw`

object is a list of `n`

numeric vectors, each of the same length as the corresponding non-zero vectors in the `nb`

object. These give the values of the spatial weights for each `i`

-`j`

neighbour pair. It is often the case that while the neighbours are symmetric by construction, the weights are not, as for example when weights are *row-standardised* by dividing each row of input weights by the count of neighbours or cardinality of the neighbour set of `i`

. In the `nb2listw`

function, it is also possible to pass through general weights, such as inverse distances, shares of boundary lengths and so on.

The third component of a `listw`

object records the `style`

of the weights as a character code, with `"B"`

for binary weights taking values zero or one (only one is recorded), `"W"`

for row-standardised weights, and so on. In order to subset `listw`

objects, knowledge of the `style`

may be necessary

It is obv