Learn R Programming

hierarchicalDS (version 3.0)

rect_adj_RW2: Produce an RW2 Adjacency matrix for a rectangular grid for use with areal spatial models. This formulation uses cofficients inspired by a thin plate spline, as described in Rue & Held, section 3.4.2 Here I'm outputting an adjacency matrix of 'neighbor weights' which makes Q construction for regular latices easy to do when not trying to make inference about all cells (i.e., one can just eliminate rows and columns associated with cells one isn't interested in and set Q=-Adj+Diag(sum(Adj))

Description

Produce an RW2 Adjacency matrix for a rectangular grid for use with areal spatial models. This formulation uses cofficients inspired by a thin plate spline, as described in Rue & Held, section 3.4.2 Here I'm outputting an adjacency matrix of 'neighbor weights' which makes Q construction for regular latices easy to do when not trying to make inference about all cells (i.e., one can just eliminate rows and columns associated with cells one isn't interested in and set Q=-Adj+Diag(sum(Adj))

Usage

rect_adj_RW2(x, y, byrow = FALSE)

Arguments

x

number of cells on horizontal side of grid

y

number of cells on vertical side of grid

byrow

If TRUE, cell indices are filled along rows (default is FALSE)

Value

adjacency matrix