disscenter {TraMineR}R Documentation

Compute distance to center of a group

Description

Compute the dissimilarity between each objects and group centers according to a matrix of dissimilarity.

Usage

disscenter(diss, group=NULL, medoids.index=NULL)

Arguments

diss A matrix of dissimilarity such as the one computed by seqdist, or a dist object (see dist
group If null, only one group is considered, otherwise group to compute center
medoids.index If NULL, return dissimilarity to center. If equal to "first", return the index of the first encountered most central sequence. One index per group is returned. If equal to "all", all medoids index are returned. If group is set, one list per group is returned.

Details

This method compute the dissimilarity between a given objects and its group center. The group center may not belong to the space formed by the objects (in the same way, the average do not belong to a space formed by discrete measure). This distance can also be understood as the contribution to the discrepancy (see dissvar). The dissimilarity between a given objects and its group center may be negative if the dissimilarity measure do not respect the triangle inequality.

It can be shown that this dissimilarity is equal to Batagelj, 1988:

d_(xg)=1/n *(sum d_xi - SS)

Where SS is the sum of square (see dissvar).

Value

A vector with the dissimilarity to center of group for each sequence, or a list of medoid index

References

Studer, M., G. Ritschard, A. Gabadinho and N. S. Müller (2009). Analyse de dissimilarités par arbre d'induction. Revue des Nouvelles Technologies de l'Information, EGC'2009.

Batagelj, V. (1988). Generalized ward and related clustering problems. In H. Bock (Ed.), Classification and related methods of data analysis, pp. 67-74. North-Holland, Amsterdam.

See Also

dissvar to compute discrepancy using dissimilarities and for a basic introduction to concepts of discrepancy analysis

dissassoc to test association between dissimilarity and another variable

disstree to analyse dissimilarities using induction trees

dissmfac to perform multi-factor analysis of variance using dissimilarities

Examples

## Defining a state sequence object
data(mvad)
mvad.seq <- seqdef(mvad[, 17:86])

## Building dissimilarities
mvad.lcs <- seqdist(mvad.seq, method="LCS")

## Compute distance to center according to group gcse5eq
dc <- disscenter(mvad.lcs, group=mvad$gcse5eq)

## Ploting distribution of dissimilarity  to center 
boxplot(dc~mvad$gcse5eq, col="cyan")

## Retrieving index of the first medoids, one per group
dc <- disscenter(mvad.lcs, group=mvad$Grammar, medoids.index="first")
print(dc)

## Retrieving index of all medoids in each group
dc <- disscenter(mvad.lcs, group=mvad$Grammar, medoids.index="all")
print(dc)

[Package TraMineR version 1.2-1 Index]