Skip to contents

Computes a selection of internal clustering evaluation metrics for spatial data.

Usage

getSpatialInternalMetrics(
  labels,
  location,
  k = 6,
  level = "class",
  metrics = c("CHAOS", "PAS", "ELSA"),
  ...
)

Arguments

labels

A vector containing the labels to be evaluated.

location

A numerical matrix containing the location information, with rows as samples and columns as location dimensions.

k

The size of the spatial neighborhood to look at for each spot. This is used for calculating PAS and ELSA scores.

level

The level to calculate the metrics. Options include "element", "class" and "dataset".

metrics

The metrics to compute. See details.

...

Optional params for PAS().

Value

A data.frame of metrics.

Details

The allowed values for metrics depend on the value of level:

  • If level = "element", the allowed metrics are: "PAS", "ELSA".

  • If level = "class", the allowed metrics are: "CHAOS", "PAS", "ELSA".

  • If level = "dataset", the allowed metrics are:

    • "PAS": Proportion of abnormal spots (PAS score)

    • "ELSA": Entropy-based Local indicator of Spatial Association (ELSA score)

    • "CHAOS": Spatial Chaos Score.

    • "MPC": Modified partition coefficient

    • "PC": Partition coefficient

    • "PE": Partition entropy

Examples

data(sp_toys)
data <- sp_toys
getSpatialInternalMetrics(data$label, data[,c("x", "y")], k=6, level="class")
#> the specified variable is considered as categorical...
#>   class         PAS    ELSA.Ea   ELSA.Ec       ELSA     CHAOS
#> 1     1 0.008333333 0.07106927 0.1940084 0.06040663 0.2305866
#> 2     2 0.008333333 0.06918805 0.1944579 0.05840334 0.2305866