Skip to content

geodalib / lisa/src / spatialLag

Function: spatialLag()

spatialLag(values, neighbors, rowStandardize, weights?, useSelfNeighbor?): number[]

Defined in: lisa/src/sa/spatial-lag.ts:24

Compute spatial lag of a list of values based on a list of neighbors and weights.

Example

ts
import { spatialLag } from '@geoda/lisa';

const values = [1, 2, 3, 4, 5];
const neighbors = [[1], [0, 2], [1, 3], [2, 4], [3]];

const result = spatialLag(values, neighbors);

console.log(result);

Parameters

values

number[]

The numeric values to compute spatial lag for.

neighbors

number[][]

The list of neighbors for each value.

rowStandardize

boolean = true

The flag to row standardize the spatial lag.

weights?

number[][]

The weight values for each neighbor.

useSelfNeighbor?

boolean

The flag to include self as a neighbor.

Returns

number[]

The spatial lag values.