Facility for growing a regression tree for a state sequence object.

1 2 3 4 |

`formula` |
a formula where the left hand side is a state sequence object (see |

`weighted` |
Logical. If |

`data` |
a data frame where variables in the formula will be searched |

`min.size` |
minimum number of cases in a node, in percentage 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 p-value, in percent. |

`weight.permutation` |
Weights permutation method: "diss" (attach weights to the dissimilarity matrix), "replicate" (replicate case according to the |

`seqdist.args` |
list of arguments directly passed to |

`diss` |
An optional dissimilarity matrix. If not provided, a dissimilarity matrix is computed using |

`squared` |
Logical. If |

`first` |
Character. An optional variable name to force the first split. |

`minSize` |
Deprecated. Use |

`maxdepth` |
Deprecated. Use |

`seqdist_arg` |
Deprecated. Use |

The function provides a simplified interface for applying `disstree`

on state sequence objects.

The `seqtree`

objects can be "plotted" with `seqtreedisplay`

. A print method is also available which prints the medoid sequence for each terminal node.

A `seqtree`

object with same attributes as `disstree`

objects.

The leaf membership is in the first column of the fitted attribute. For example, the leaf memberships for a tree `dt`

are in `dt$fitted[,1]`

.

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.

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 | ```
data(mvad)
## Defining a state sequence object
mvad.seq <- seqdef(mvad[, 17:86])
## Growing a seqtree from Hamming distances:
## Warning: The R=10 used here to save computation time is
## much too small and will generate strongly unstable results.
## We recommend to set R at least as R=1000.
## To comply with this small R value, we set pval = 0.1.
seqt <- seqtree(mvad.seq~ male + Grammar + funemp + gcse5eq + fmpr + livboth,
data=mvad, R=10, pval=0.1, seqdist.arg=list(method="HAM", norm=TRUE))
print(seqt)
## Growing a seqtree from an existing distance matrix
mvad.dhd <- seqdist(mvad.seq, method="DHD")
seqt <- seqtree(mvad.seq~ male + Grammar + funemp + gcse5eq + fmpr + livboth,
data=mvad, R=10, pval=0.1, diss=mvad.dhd)
print(seqt)
### Following commands only work if GraphViz is properly installed
## Not run:
seqtreedisplay(seqt, type="d", border=NA)
seqtreedisplay(seqt, type="I", sortv=cmdscale(mvad.dhd, k=1))
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.