disstree: Dissimilarity Tree

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/disstree.R

Description

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

Usage

1
2
3
4
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)

Arguments

formula

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

data

Data frame where variables in formula will be searched for.

weights

Optional numerical vector of weights.

min.size

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

max.depth

Maximum depth of the tree

R

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

pval

Maximum allowed p-value for a split

object

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

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.)

squared

Logical: Should the diss dissimilarities be squared?

first

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.

minSize

Deprecated. Use min.size instead.

maxdepth

Deprecated. Use max.depth instead.

Details

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.

Value

An object of class disstree that contains the following components:

root

A node object, root of the tree

info

General information such as parameters used to build the tree

info$adjustment

A dissassoc object providing global statistics for tree.

formula

The formula used to generate the tree

data

data used to build the tree

weights

weights

Author(s)

Matthias Studer (with Gilbert Ritschard for the help page)

References

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
data(mvad)

## 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)
print(dt)


## 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)

Example output

TraMineR stable version 2.0-11.1 (Built: 2019-05-12)
Website: http://traminer.unige.ch
Please type 'citation("TraMineR")' for citation information.

 [>] 6 distinct states appear in the data: 
     1 = FE
     2 = HE
     3 = employment
     4 = joblessness
     5 = school
     6 = training
 [>] state coding:
       [alphabet]  [label]     [long label] 
     1  FE          FE          FE
     2  HE          HE          HE
     3  employment  employment  employment
     4  joblessness joblessness joblessness
     5  school      school      school
     6  training    training    training
 [>] 712 sequences in the data set
 [>] min/max sequence length: 70/70
 [>] 712 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 490 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.302 secs
Dissimilarity tree:
 Parameters: min.size=35.6, max.depth=5, R=10, pval=0.1 
 Formula: mvad.ham ~ male + Grammar + funemp + gcse5eq + fmpr + livboth 
 Global R2: 0.10642 

 Fitted tree: 

 |-- Root  (n: 712 disc: 22.923) 
   |-> gcse5eq 0.072831 
             |-- [ no ]  (n: 452 disc: 20.474) 
               |-> funemp 0.011517 
                   |-- [ no ]  (n: 362 disc: 19.512) 
                     |-> male 0.01217 
                         |-- [ no ]    (n: 146 disc: 21.16)[412] * 
                         |-- [ yes ]    (n: 216 disc: 18)[65] * 
                   |-- [ yes ]    (n: 90 disc: 23.157)[401] * 
             |-- [ yes ]  (n: 260 disc: 22.61) 
               |-> Grammar 0.05046 
                   |-- [ no ]  (n: 183 disc: 22.761) 
                     |-> fmpr 0.014194 
                         |-- [ no ]    (n: 120 disc: 22.005)[176] * 
                         |-- [ yes ]    (n: 63 disc: 23.262)[557] * 
                   |-- [ yes ]    (n: 77 disc: 18.4)[32] * 
sh: 1: dot: Permission denied
sh: 0: Can't open /dev/null
 [>] 712 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 490 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.343 secs
 [>] 452 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 339 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.118 secs
 [>] 362 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 275 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.115 secs
 [>] 146 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 127 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.058 secs
 [>] 216 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 161 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.069 secs
 [>] 90 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 78 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.07 secs
 [>] 260 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 178 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.07 secs
 [>] 183 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 136 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.081 secs
 [>] 120 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 94 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.062 secs
 [>] 63 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 54 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.058 secs
 [>] 77 sequences with 6 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 6x6 substitution-cost matrix using 1 as constant value
 [>] 55 distinct sequences
 [>] min/max sequence length: 70/70
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.047 secs
sh: 1: dot: Permission denied
sh: 0: Can't open /dev/null

TraMineR documentation built on June 3, 2021, 5:06 p.m.