SKATER

Spatial C(K)luster Analysis by Tree Edge Removal (SKATER) is an optimized algorithm to prune the minimum spanning tree into several clusters that their values of selected variables are as similar as possible while retaining the contiguity structure. For more information, please read https://geodacenter.github.io/workbook/9c_spatial3/lab9c.html#skater

skater()

function skater(
    WeightResult w,
    Number k, 
    Array vals,
    Number min_bound, 
    Array bound_vals,
    String scale_method,
    String distance_type)

Arguments

Name

Type

Description

weights

WeightsResult

The weights object WeightsResult

k

Number

The number of clusters

values

Array

The list of numeric vectors of selected variable

min_bound

Number

The minimum value that the sum value of bounding variable int each cluster should be greater than

bound_vals

Array

The numeric vector of selected bounding variable

scale_method

String

The scaling method: {'raw', 'standardize', 'demean', 'mad', 'range_standardize', 'range_adjust'}

distance_method

String

The distance method: {"euclidean", "manhattan"}

Return

Type

Description

ClusteringResult

The Clustering object: {'total_ss', 'within_ss', 'between_ss', 'ratio', 'clusters'}

Examples

const jsgeoda = require('jsgeoda');
const fs = require('fs');

// load data
const data = fs.readFileSync('./data/natregimes.geojson').buffer;

// create jsgeoda instance
const geoda = await jsgeoda.New();

// load geojson in jsgeoda
const nat = geoda.read_geojson(data);

// create a queen contiguity weights
const w = geoda.queen_weights(nat);

// get values
const hr60 = geoda.get_col(nat, "HR60");
const ue60 = geoda.get_col(nat, "UE60");

// set minimum bound
const po60 = geoda.get_col(nat, "PO60");

// apply skater
const skater = geoda.skater(w, 10, [hr60, ue60], 17845200, po60);

Try it yourself in the playground (jsgeoda + deck.gl):

Last updated