help combinadd

Title

combinadd -- Calculate inter-sequence distances using Elzinga's duration-weighted subsequence counting

Syntax

combinadd varlist , options [option]

options

Required
nspells(#) Name the variable which stores the number of spells

nstates(#) Name the variable which stores the number of states

pwsim(string) Name the matrix which will store the similarities or distances

Optional
rtype(string) Generate similarities or distances: "s"
for similarities, "d" for distances, "r" for raw SXY values. Defaults to
similarities.

workspace Show workings

maxtuples(integer) Maximum number of tuples (subsequences) to count in one sequence (default 40000)

Description

combinadd calculates a version of Elzinga's
duration-weighted number of common subsequences measure for
spell-structured data. The variable list must identify the spell
structure in the form state-1, duration-1, state-2, duration-2, ...
state-X, duration-X where X is the maximum number of spells observed.
The nspells option identifies the variable that stores the case-specific number of spells.

States must be numbered as integers from 1 up.

The measure counts the number of spell sub-sequences common to
each pair of sequences, weighted by the combined duration of the
subsequence. The number of subsequences in a sequence increases very
rapidly with the length of the sequence, with major consequences for
memory demands. This implementation can handle sequences with of the
order of 15 spells without too much difficulty. The maxtuples limit
causes the command to stop if too many subsequences are observed, in
order to avoid running out of memory. The maxtuples option can be used
to judiciously raise this limit.

It uses a Stata plugin implementation.

See cal2spell for a way of converting calendar
representations to spell representations.

References

Elzinga, C. H. (2003).
Sequence similarity: A non-aligning technique.
Sociological Methods and Research, 32(1):3--29.

Elzinga, C. H. (2005).
Combinatorial representations of token sequences.
Journal of Classification, 22(1):87--118.

Elzinga, C. H. (2006).
Sequence analysis: Metric representations of categorical time series.
Technical report, Free University of Amsterdam.

Halpin, Brendan. (2014). Three narratives of sequence
analysis, Bühlmann et al (eds), Advances in Sequence Analysis.
Beyond the Core Program, Springer

Author

Brendan Halpin, brendan.halpin@ul.ie

Examples

. cal2spell, state(m) spell(sp) length(l) nsp(nspells)

. local nsp = r(maxspells)

. local nel = r(nels)

. combinadd sp1-l`nsp', pwsim(xtd) nspells(nspells) nstates(`nel') rtype(d)