disstree: Dissimilarity Tree

View source: R/disstree.R

disstreeR Documentation

Dissimilarity Tree


Tree structured discrepancy analysis of objects described by their pairwise dissimilarities.


disstree(formula, data = NULL, weights = NULL, min.size = 0.05,
  max.depth = 5, R = 1000, pval = 0.01, object = NULL,
  weight.permutation = "replicate", squared = FALSE, first = NULL,
  minSize, maxdepth)



Formula with a dissimilarity matrix as left hand side and the candidate partitioning variables on the right side.


Data frame where variables in formula will be searched for.


Optional numerical vector of weights.


Minimum number of cases in a node, will be treated as a proportion if less than 1.


Maximum depth of the tree


Number of permutations used to assess the significance of the split.


Maximum allowed p-value for a split


An optional R object represented by the dissimilarity matrix. This object may be used by the print method or disstree2dot to render specific object type.


Weight permutation method: "diss" (attach weights to the dissimilarity matrix), "replicate" (replicate cases using weights), "rounded-replicate" (replicate case using rounded weights), "random-sampling" (random assignment of covariate profiles to the objects using distributions defined by the weights.)


Logical: Should the diss dissimilarities be squared?


One of the variable in the right-hand side of the formula. This forces the first node of the tree to be split by this variable.


Deprecated. Use min.size instead.


Deprecated. Use max.depth instead.


The procedure iteratively splits the data. At each step, the procedure selects the variable and split that explain the greatest part of the discrepancy, i.e., the split for which we get the highest pseudo R2. The significance of the retained split is assessed through a permutation test.

seqtree provides a simpler interface if you plan to use disstree for state sequence objects.


An object of class disstree that contains the following components:


A node object, root of the tree


General information such as parameters used to build the tree


A dissassoc object providing global statistics for tree.


The formula used to generate the tree


data used to build the tree




Matthias Studer (with Gilbert Ritschard for the help page)


Studer, M., G. Ritschard, A. Gabadinho and N. S. Müller (2011). Discrepancy analysis of state sequences, Sociological Methods and Research, Vol. 40(3), 471-510, doi: 10.1177/0049124111415372.

Studer, M., G. Ritschard, A. Gabadinho and N. S. Müller (2010) Discrepancy analysis of complex objects using dissimilarities. In F. Guillet, G. Ritschard, D. A. Zighed and H. Briand (Eds.), Advances in Knowledge Discovery and Management, Studies in Computational Intelligence, Volume 292, pp. 3-19. Berlin: Springer.

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

Anderson, M. J. (2001) A new method for non-parametric multivariate analysis of variance. Austral Ecology 26, 32-46.

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

Piccarreta, R. et F. C. Billari (2007) Clustering work and family trajectories by using a divisive algorithm. Journal of the Royal Statistical Society A 170(4), 1061–1078.

See Also

seqtree to generate a specific disstree objects for analyzing state sequences.
seqtreedisplay to generate graphic representation of seqtree objects when analyzing state sequences.
disstreedisplay is a more general interface to generate such representation for other type of objects.
dissvar to compute discrepancy using dissimilarities and for a basic introduction to discrepancy analysis.
dissassoc to test association between objects represented by their dissimilarities and a covariate.
dissmfacw to perform multi-factor analysis of variance from pairwise dissimilarities.
disscenter to compute the distance of each object to its group center from pairwise dissimilarities.



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

## Computing dissimilarities (any dissimilarity measure can be used)
mvad.ham <- seqdist(mvad.seq, method="HAM")
## Grow the tree using using a low R value for illustration.
## For R=10, pval cannot be lower than 0.1
dt <- disstree(mvad.ham~ male + Grammar + funemp + gcse5eq + fmpr + livboth,
    data=mvad, R = 10, pval = 0.1)

## Will only work if GraphViz is properly installed
## See seqtree for simpler way to plot a sequence tree.
## Not run: 
disstreedisplay(dt, image.fun = seqdplot, image.data = mvad.seq,
  ## Additional parameters passed to seqdplot
  with.legend = FALSE, axes = FALSE, ylab = "")

## End(Not run)
## Second method, using a specific function
myplotfunction <- function(individuals, seqs, ...) {
	par(font.sub=2, mar=c(3,0,6,0), mgp=c(0,0,0))
	## using mds to order sequence in seqiplot
	mds <- cmdscale(seqdist(seqs[individuals,], method="HAM"),k=1)
	seqiplot(seqs[individuals,], sortv=mds,...)

## If image.data is not set, index of individuals are sent to image.fun
## Not run: 
disstreedisplay(dt, image.fun = myplotfunction, cex.main = 3,
  ## additional parameters passed to myplotfunction
  seqs = mvad.seq,
  ## additional parameters passed to seqiplot (through myplotfunction)
  with.legend = FALSE, axes = FALSE, idxs = 0, space = 0, ylab = "", border = NA)

## End(Not run)

TraMineR documentation built on Dec. 1, 2022, 5:08 p.m.