Skip to content

Discrepancy Analysis: Sequenzo and TraMineR Mapping

This page maps Sequenzo discrepancy-analysis functions to their closest R counterparts. Most names below are from TraMineR core; dissindic() is from TraMineRextras.

What This Section Covers

This section focuses on discrepancy-based sequence analysis: overall discrepancy, pseudo-ANOVA on dissimilarities, weighted permutation tests, multifactor models, regression trees, and window-wise group comparisons along the time axis.

For TraMineR users, this is the diss* family plus the seqdiff and seqtree workflows described in Studer et al. (2011). Distance matrices are usually built first with seqdist() in TraMineR or get_distance_matrix() in Sequenzo.

Main Mapping Table

Sequenzo functionR counterpartNotes
overall_discrepancyTraMineR::dissvar()Overall discrepancy from a distance matrix; squared=False uses v = 1 and squared=True uses v = 2.
single_factor_associationTraMineR::dissassoc()Single-factor pseudo-ANOVA on distances; returns pseudo F, pseudo Fbf, pseudo R², Bartlett, and Levene summaries.
marginal_factor_associationrepeated TraMineR::dissassoc()One dissassoc() per covariate column; raw marginal association, not Type II partial effects.
multifactor_associationTraMineR::dissmfacw()Multifactor model with Type II-style partial contributions after other covariates are included.
distance_multifactor_anovaTraMineR::dissmfacw()Lower-level multifactor engine behind multifactor_association().
gower_matrixinternal Gower-centering step in TraMineR::dissmfacw()Centered Gower matrix used for distance-based multifactor ANOVA.
individual_indicatorsTraMineRextras::dissindic()Individual marginality and gain indicators; not exported from TraMineR core.
merge_cluster_groupsTraMineR::dissmergegroups()Greedy merging of cluster labels by partition-quality loss.
compare_groups_across_positionsTraMineR::seqdiff()Window-wise local discrepancy scan along the time axis.
print_group_differences_across_positionsprint() on a TraMineR seqdiff objectText summary of a seqdiff object; TraMineR registers this as an S3 method.
plot_group_differences_across_positionsplot() on a TraMineR seqdiff objectPlot statistics or discrepancy profiles across anchor positions; TraMineR registers this as an S3 method.
distance_treeTraMineR::disstree()Distance-based regression tree on a distance matrix plus predictors.
sequence_treeTraMineR::seqtree()Sequence-facing wrapper that can compute the distance matrix before calling the tree fitter.
test_tree_splitinternal split-significance logic behind TraMineR::disstree()Permutation test for one candidate tree split.
get_leaf_membershipTraMineR::disstreeleaf()Leaf ID or readable path label for each sequence.
get_classification_rulesTraMineR::disstree.get.rules()Human-readable rules for terminal nodes.
assign_to_leavesTraMineR::disstree.assign()Assign new profiles to fitted leaves using tree rules.
print_treeprint() on TraMineR disstree / seqtree objectsText display of a fitted tree; TraMineR registers these as S3 methods.
plot_treeTraMineR::disstreedisplay() / TraMineR::seqtreedisplay()GraphViz-based tree display for fitted distance-tree or sequence-tree objects.
export_tree_to_dotTraMineR::disstree2dot() / TraMineR::seqtree2dot()Export a tree to Graphviz DOT format.
permutation_testTraMineR internal permutation wrapperGeneric permutation wrapper aligned with TraMineR's internal permutation logic.
association_permutation_testTraMineR internal dissassocweighted.* helpersFive-statistic dissassoc permutation engine used by single_factor_association().

Parameter Mapping for Core Entry Points

Sequenzo argumentTraMineR argumentApplies to
distance_matrixdissoverall_discrepancy, single_factor_association, distance_tree, multifactor helpers
groupgroup / facsingle_factor_association
weightsweightsAll weighted discrepancy functions
RRAssociation tests, trees, and multifactor routines that support permutation
weight_permutationweight.permutationsingle_factor_association, distance_tree, sequence_tree
squaredsquaredAll routines that accept a nonsquared (v = 1) versus squared (v = 2) dissimilarity transform
predictorsformula right-hand predictorsdistance_tree, sequence_tree
min_sizemin.sizedistance_tree, sequence_tree
max_depthmaxdepthdistance_tree, sequence_tree
pvalpvaldistance_tree, sequence_tree
first_splitfirst.splitdistance_tree, sequence_tree
seqdataleft-hand formula term in seqtreesequence_tree, compare_groups_across_positions
distance_method / distance_paramsseqdist.argssequence_tree
seqdist_argsseqdist.argscompare_groups_across_positions
cmprangecmprangecompare_groups_across_positions
with_missingwith.missingcompare_groups_across_positions
weightedweightedsequence_tree, compare_groups_across_positions
factorsformula predictors in dissmfacwmultifactor_association, marginal_factor_association
gowergowermultifactor_association, individual_indicators

TraMineR tree functions also accept max.depth and first as formal argument names. This guide uses maxdepth and first.split to match the Studer et al. (2011) examples and the other pages in this section.

Important Workflow Differences

  • Import surface. Import discrepancy functions from sequenzo.discrepancy_analysis only. Internal folders such as stats/, trees/, positionwise/, and internal/ are for maintainers.
  • Distance input. TraMineR often passes a dist object or matrix through a formula. Sequenzo usually takes an explicit distance_matrix, except in sequence_tree() and compare_groups_across_positions().
  • Weighted permutation default. Sequenzo resolves weight_permutation=None the same way TraMineR does for dissassoc(), disstree(), and seqtree(): "none" without weights and "replicate" when weights are supplied. Unweighted calls also resolve to "none" inside TraMineR dissassocweighted() and DTNdisstree(). For survey or calibration weights, pass weight_permutation="diss" explicitly, as recommended by Studer et al. (2011). The seqdiff workflow calls dissassoc(..., weight.permutation = "diss") for local window scans, and compare_groups_across_positions() follows that path.
  • Marginal versus multifactor. marginal_factor_association() is not a substitute for dissmfacw. Use multifactor_association() when you need conditional Type II-style contributions after other covariates are included.
  • Position-wise scan. compare_groups_across_positions() rebuilds local distance matrices inside a moving window. It is not a cell-by-cell state composition comparison unless the window length is effectively one.
  • Representative and factor plots. TraMineR also provides disscenter, dissrep, dissrf, dissdomassoc, disstreedisplay, and seqtreedisplay. Sequenzo does not expose one-to-one public wrappers for those helpers in this module.
TraMineR functionTypical role
TraMineR::disscenter()Gravity center / medoid search from a distance matrix
TraMineR::dissrep()Representative sequence selection from distances
TraMineR::dissrf()Relative-frequency groups from distances
TraMineR::dissdomassoc()Association between domain-specific distance matrices
TraMineR::disstreedisplay() / TraMineR::seqtreedisplay()Rich tree displays beyond the basic plot_tree() helper

Authors

Code and documentation: Yuqi Liang

Reference

Studer, M., Ritschard, G., Gabadinho, A., & Müller, N. S. (2011). Discrepancy analysis of state sequences. Sociological Methods & Research, 40(3), 471–510.

Sequenzo is released under the BSD-3-Clause License; this documentation site source is licensed under MIT.