gini.index: Gini index.

View source: R/sparseness_funcs.R

gini.indexR Documentation

Gini index.

Description

gini.index returns the Gini index of the ion intensity vector as a measure of its sparseness. The intensity vector is first quantized in N levels (default = 256). A value close to 1 represents a high level of sparseness, a value close to 0 represents a low level of sparseness.

Usage

gini.index(x, levels = 256)

Arguments

x

numeric. Peak intensity array.

levels

numeric (default = 256). Number of levels for the peak intensity quantization.

Value

A value between 0 and 1. High levels of signal sparsity are associated with values close to 1, whereas low levels of signal sparsity are associated with values close to 0.

Author(s)

Paolo Inglese p.inglese14@imperial.ac.uk

References

Hurley, N., & Rickard, S. (2009). Comparing measures of sparsity. IEEE Transactions on Information Theory, 55(10), 4723-4741.

See Also

scatter.ratio spatial.chaos

Examples

## Load package
library("SPUTNIK")

## Image
im <- matrix(rnorm(100), 10, 10)
im[im < 0] <- 0

## Spatial chaos
sc <- spatial.chaos(im, levels = 30, morph = TRUE)
stopifnot(sc <= 1)

## Gini index
gi <- gini.index(im, levels = 16)
stopifnot(gi >= -1 && gi <= 1)

## Scatter ratio
sr <- scatter.ratio(im)
stopifnot(sr <= 1)

SPUTNIK documentation built on Nov. 24, 2022, 5:06 p.m.