help ndsub

Title

ndsub -- Count the number of distinct subsequences in a sequence

Syntax

ndsub, GEN(newvarname) STAtevars(string) NSPells(string) NSTates(real)

options

Required
gen(varname) names the variable in which to store the number of distinct subsequences

statevars(varlist) the variables holding the spell state information

nspells(varname) the variable holding the number of spells in each sequence

nstates(real) the number of distinct states

Description

ndsub Calculates the number of distinct subsequences in a
sequence, where a subsequence is an ordered subset of the sequence, not
necessarily consecutive. The STATEVARS option identifies the variables
holding the sequence state information, and the NSPELLS option the
variable holding the length of the sequence.

The number of distinct subsequences is an input to a number of other measures, such as Elzinga's turbulence measure.
Elzinga's "phi" measure is the base-2 log of the number of distinct subsequences - to calculate, see under "Examples" below.

Note: Assumes sequences are represented by consecutive variables containing numeric values.

Author

Brendan Halpin, brendan.halpin@ul.ie

Examples

. use mvad

. cal2spell, state(state) spell(spell) length(dur) nspells(nsp)

. ndsub, gen(nsubs) sta(spell*) nsp(nsp) nst(5)

. gen phi = log(nsubs)/log(2)

See Also

cal2spell

combinadd

turbulence

sadi