help sqmodalplot                                                (SJ6-4: st0111)


sqmodalplot -- Sequence index plots of modal sequences


sqmodalplot [if] [in] [, options]

options Description ------------------------------------------------------------------------- so apply same order similarity over(varname) show plots for categories of varname by(varname) plot groups of sequences based on varname color(colorstyle) apply colors to the elements gapinclude include sequences with gaps in the tabulation subsequence(a,b) use only subsequence between positions a and b tie(keyword) how to resolve ties, if any twoway_options options allowed with graph twoway -------------------------------------------------------------------------


sqmodalplot draws sequence index plots of modal sequences. A modal sequence is an artificial sequence composed by the most frequent element for each position. Think of the modal sequence as some form of an ideal-typical sequence. Note that the notion of "ideal"-type implies that the modal sequence do not necessarily exist as a whole in the data set.

The plot is usefull to show the results of a cluster analysis on the distance matrix created by sqom, full. Another use is to inform the user about possible settings for the option idealtype() of sqom.


over(varname) is used to show one line for each category of the over-variable. A typical use of over is, to show the modal sequence for each cluster found in a preceding cluster analysis.

tie(keyword) deals with cases, in which more than one element is the most frequent element at a certain position. The default behavior is to plot the element that is the most frequent accross all positions (for an category of over). Alternatively it is possible to plot a gap, the previous, or the following element of the modal sequence at that positon. The alternative behaviour are controlled using one of the following keywords:

keyword Explanation ----------------------------------------------------- gap plot nothing; the default mode most frequent element accross all positions lag the next element of the modal sequence lead the previous element of the modal sequence highest the element with the highest level lowest the element with the lowest level -----------------------------------------------------

so is used to request a plot where only the order of elements is shown (same-order similarity). With this option the sequences A-B-B-A and A-B-A-A would both be drawn as if they were A-B-A.

by(varname) specifies to plot groups of sequences separately based on varname.

color(colorstyle) specifies the colors for the elements. You can specify one color for each element, whereby the first color refers to the element with the lowest level. See colorstyle for a list of color choices.

gapinclude is used to include sequences with gaps. The default behavior is to drop sequences with gaps from the graph. The term gap refers only to missing values on the element variable within a sequence. Sequences with missing values at the begining and at the end of a sequence are included in any case. You might consider using sqset with option trim to get rid of superfluous missings (see sq for details.)

subsequence(a,b) is used to include only the part of the sequence that is between position a and b, whereby a and b refer to the position defined in order variable.

twoway_options are a set of common options supported by all twoway commands; see twoway_options.


. sqmodalplot . sqmodalplot, over(sex) color(black red yellow) . sqmodalplot, over(sex) tie(gap) so

. sqom, full k(2) . sqclusterdat . clustermat wardslinkage SQdist, name(myname) add . cluster generate cluster = groups(5) . sqclusterdat, return keep(cluster) . sqmodalplot, over(cluster) color(black red yellow green cranberry) by(sex)


Ulrich Kohler, WZB,

Also see

Manual: [G] graph, [G] graph twoway rbar, [G] barlook options

Online: sq, sqdemo, sqset, sqdes, sqegen, sqstat, sqindexplot, sqparcoord, sqom, sqclusterdat, sqclustermat, sqmdsadd