coords2listw: Convert coordinates to a listw object

View source: R/moran.R

coords2listwR Documentation

Convert coordinates to a listw object

Description

Parameters for this should be based on biological knowledge. The algorithm does a k nearest neighbor search and then selects all cells that are less than maxDist distance from the center as neighbors with nonzero weights. If k is chosen too small then it's possible for the weight matrix to be nonsymmetric because the k nearest neighbors are not symmetric. Choosing k large seems to be pretty quick still.

Usage

coords2listw(x, k = 200, maxDist = 50, comp = NULL, W = 1)

Arguments

x

A matrix of coordinates (of cell centroids)

k

The maximum number of neighbors each cell can have

maxDist

The maximum distance a neighbor can be from the central cell

comp

A vector of integers, strings, or factors, indicating what tissue compartment each cell belongs to

W

The weights used for the surrounding cells. defaults to 1

Value

Returns a list of matrices, where each matrix is the multivariate Moran's I for each tissue compartment.


statimagcoll/multiplexMoran documentation built on June 27, 2022, 4:26 p.m.