Analytics Toolbox for Redshift

Analytics Toolbox for Redshift

statistics

This module contains functions to perform spatial statistics calculations.

MORANS_I_QUADBIN

Description

This function computes the Moran’s I spatial autocorrelation from the input array of quadkey indexes.

  • input: SUPER input data with the indexes and values of the cells.
  • size: INT8 size of the quadkey kring (distance from the origin). This defines the area around each index cell where the distance decay will be applied.
  • decay: VARCHAR decay function to compute the distance decay. Available functions are: uniform, inverse, inverse_square and exponential.

Return type

FLOAT8

Example

1
2
3
4
5
6
7
8
9
SELECT carto.MORANS_I_QUADBIN(
    JSON_PARSE('[
        {"index": 5266443791927869439, "value": 51.0},
        {"index": 5266443791928131583, "value": 28.0},
        {"index": 5266443791928918015, "value": 19.0}
    ]'),
    3, 'exponential'
);
-- -0.2966571382680862