R: Inter-cluster density - Internal Measure

clv.Dens_bw {clv} | R Documentation

## Inter-cluster density - Internal Measure

### Description

Function computes inter-cluster density.

### Usage

    clv.DensBw(data, clust, scatt.obj, dist="euclidean")

### Arguments

`data` | `matrix` or `data.frame` where columns correspond to variables and rows to observations
`clust` | integer `vector` with information about cluster id the object is assigned to. If vector is not integer type, it will be coerced with warning.
`scatt.obj` | object returned by `clv.Scatt` function.
`dist` | chosen metric: "euclidean" (default value), "manhattan", "correlation"

### Details

The definition of inter-cluster density is given by equation:

`Dens_bw` = 1/(|C|*(|C|-1)) * sum{forall i in 1:|C|} sum{forall j in 1:|C| and j != i} density(u(i,j))/max{density(v(i)), density(v(j))}

where:

|C| | - number of clusters,
v(i), v(j) | - centers of clusters i and j,
u(i,j) | - middle point of the line segment defined by the clusters' centers v(i), v(j),
density(x) | - see below.

Let define function f(x,u):

f(x,u) = 0 | if dist(x,u) > stdev (stdev is defined in `clv.Scatt`)
f(x,u) = 1 | otherwise

Function f is used in definition of density(u):

density(u) = sum{forall i in 1:n(i,j)} f(xi,u)

where n(i,j) is the number of objects which belongs to clusters i and j and xi is such object.

This value is used by `clv.SDbw`.

### Value

As result `Dens_bw` value is returned.

### Author(s)

Lukasz Nieweglowski

### See Also

`clv.SD` and `clv.SDbw`

### Examples

    # load and prepare data
    library(clv)
    data(iris)
    iris.data <- iris[,1:4]

    # cluster data
    agnes.mod <- agnes(iris.data) # create cluster tree
    v.pred <- as.integer(cutree(agnes.mod,5)) # "cut" the tree

    # compute Dens_bw index
    scatt <- clv.Scatt(iris.data, v.pred)
    dens.bw <- clv.DensBw(iris.data, v.pred, scatt)

[Package clv version 0.3-2.2 Index]