Learn R Programming

nimble (version 1.2.1)

as.carCM: Convert weights vector to parameters of dcar_proper distributio

Description

Convert weights vector to C and M parameters of dcar_proper distribution

Usage

as.carCM(adj, weights, num)

Value

A named list with elements C and M. These may be used as the C and M arguments to the dcar_proper distribution.

Arguments

adj

vector of indices of the adjacent locations (neighbors) of each spatial location. This is a sparse representation of the full adjacency matrix.

weights

vector of symmetric unnormalized weights associated with each pair of adjacent locations, of the same length as adj. This is a sparse representation of the full (unnormalized) weight matrix.

num

vector giving the number of neighbors of each spatial location, with length equal to the total number of locations.

Author

Daniel Turek

Details

Given a symmetric matrix of unnormalized weights, this function will calculate corresponding values for the C and M arguments suitable for use in the dcar_proper distribution. This function can be used to transition between usage of dcar_normal and dcar_proper, since dcar_normal uses the adj, weights, and num arguments, while dcar_proper requires adj, num, and also the C and M as returned by this function.

Here, C is a sparse vector representation of the row-normalized adjacency matrix, and M is a vector containing the conditional variance for each region. The resulting values of C and M are guaranteed to satisfy the symmetry constraint imposed on \(C\) and \(M\), that \(M^{-1} C\) is symmetric, where \(M\) is a diagonal matrix and \(C\) is the row-normalized adjacency matrix.

See Also

CAR-Normal, CAR-Proper