Learn R Programming

ClustGeo (version 2.1)

inert: Inertia of a cluster

Description

Computes the inertia of a cluster i.e. on a subset of rows of a data matrix.

Usage

inert(
  Z,
  indices = 1:nrow(Z),
  wt = rep(1/nrow(Z), nrow(Z)),
  M = rep(1, ncol(Z))
)

Arguments

Z

matrix data

indices

vectors representing the subset of rows

wt

weight vector

M

diagonal distance matrix

Examples

Run this code
# NOT RUN {
data(estuary)
n <- nrow(estuary$dat)
Z <- scale(estuary$dat)*sqrt(n/(n-1))
inert(Z) # number of variables

w <- estuary$map@data$POPULATION # non uniform weights 
inert(Z,wt=w)

# }

Run the code above in your browser using DataLab